Alexander Nasonov's shared items

Sunday, February 25, 2007

How to run print/acroread7 on FreeBSD 6.2

This instruction explains how to install and run print/acroread7 on FreeBSD 6.2 using pkgsrc. Before you start, please check that it's still broken. I hope it'll be fixed soon after my post and you would only need to follow configuration of /compat/linux.

  1. Go to emulators/suse100_base and suppress an execution of /dev/MAKEDEV - this file doesn't exist (/dev is devfs mount point on FreeBSD 6.2)
  2. % cvs diff -u Makefile
    Index: Makefile
    ===================================================================
    RCS file: /cvsroot/pkgsrc/emulators/suse100_base/Makefile,v
    retrieving revision 1.7
    diff -u -r1.7 Makefile
    --- Makefile    22 Feb 2007 19:26:27 -0000      1.7
    +++ Makefile    25 Feb 2007 18:38:10 -0000
    @@ -53,8 +53,8 @@
              ${INSTALL_SCRIPT} $$FILE ${PREFIX}/sbin/`basename $$FILE .sh`; \
            done
            ${INSTALL_DATA_DIR} ${EMULDIR}/dev
    -       ${INSTALL_DATA} /dev/MAKEDEV ${EMULDIR}/dev
    -       cd ${EMULDIR}/dev && ${SH} ./MAKEDEV  std audio
    +#      ${INSTALL_DATA} /dev/MAKEDEV ${EMULDIR}/dev
    +#      cd ${EMULDIR}/dev && ${SH} ./MAKEDEV  std audio
            cd ${EMULDIR}/dev && ${LN} -fs sound dsp
            @${CP} ${PKGDIR}/PLIST ${PLIST_SRC}
            ${RPM2PKG} ${RPM2PKGARGS}
  3. Go to print/acroread7 and patch Makefile.
  4. % cvs diff -u Makefile
    Index: Makefile
    ===================================================================
    RCS file: /cvsroot/pkgsrc/print/acroread7/Makefile,v
    retrieving revision 1.17
    diff -u -r1.17 Makefile
    --- Makefile    11 Jan 2007 11:52:17 -0000      1.17
    +++ Makefile    25 Feb 2007 19:29:36 -0000
    @@ -32,7 +32,7 @@
     # Default (overridden below)
     PLATFORM=      unknown
     
    -.if ${OPSYS} == "NetBSD" || ${OPSYS} == "DragonFly"
    +.if ${OPSYS} == "NetBSD" || ${OPSYS} == "DragonFly" || ${OPSYS} == "FreeBSD"
     . if (${MACHINE_ARCH} == "i386")
     DEPENDS+=      suse_gtk2>=10.0:../../emulators/${SUSE_DIR_PREFIX}_gtk2
     DEPENDS+=      suse_libcups>=10.0:../../emulators/${SUSE_DIR_PREFIX}_libcups
  5. Run bmake with properly set $BRANDELF. For some reason, this variable is not set when building suse100_base and it would break an installation of that package.
  6. % env BRANDELF=brandelf bmake
  7. Run
  8. % sed -i '' -e 's/\(NetBSD | DragonFly\)/\1 | FreeBSD/' work/AdobeReader/INSTALL
  9. Install acroread7
  10. % bmake install
  11. Run as root
  12. # sed -i '' -e 's/\(NetBSD | DragonFly\)/\1 | FreeBSD/' /usr/pkg/bin/acroread7
  13. Set LD_LIBRARY_PATH to
  14. LD_LIBRARY_PATH=/usr/pkg/emul/linux/usr/lib/:/usr/pkg/emul/linux/opt/gnome/lib:/usr/pkg/Acrobat7/Reader/intellinux/lib

When I completed these steps, I was able to run /usr/pkg/bin/acroread7 but later I removed packages installed from ports and I couldn't run the program anymore. To fix this, I replaced FreeBSD linux compatibility directory with pkgsrc linux emulator and regenerated gdk-pixbuf.loaders:

# mv /compat/linux /compat/linux.freebsd
# ln -s /usr/pkg/emul/linux /compat/linux
# /usr/pkg/emul/linux/opt/gnome/bin/gdk-pixbuf-query-loaders > /usr/pkg/emul/linux/etc/opt/gnome/gtk-2.0/gdk-pixbuf.loaders

This method proves that suse100 linux emulator works on FreeBSD but since it could "interfere" in a bad way with FreeBSD update procedure I went another route:

# ln -s /usr/pkg/emul/linux/opt/gnome /compat/linux/opt/gnome
# ln -s /usr/pkg/emul/linux/etc/opt/gnome /compat/linux/etc/opt/gnome
# ln -s /usr/pkg/emul/linux/opt/gnome/lib/pango /compat/linux/usr/lib/pango

You can always find these three foreign links with the find command:

% find /compat/linux -type l | xargs file | grep pkg
/compat/linux/etc/opt/gnome:                               symbolic link to `/usr/pkg/emul/linux/etc/opt/gnome'
/compat/linux/usr/lib/pango:                               symbolic link to `/usr/pkg/emul/linux/opt/gnome/lib/pango'
/compat/linux/opt/gnome:                                   symbolic link to `/usr/pkg/emul/linux/opt/gnome'

UPDATE: I thought that /compat/linux belongs to FreeBSD base system but it has been installed from linux_base port. So I can easily remove it and use suse100_base from pkgsrc. Another cool idea is to mount a real Linux to /compat/linux as described here.