Pale Moon for OpenBSD

Post your tutorials for using Pale Moon or performing related tasks here.
Note: Not for "how do I...?" Questions!

Moderator: satrow

Forum rules
Tutorials and Howtos should only relate to Pale Moon, and not to third party applications. e.g.: Don't post a Howto for configuring your firewall.
If you have a question how to do something, you should use one of the support boards, not this board. It is meant for people to document and post instructions.

Pale Moon for OpenBSD

Post by perkint » 2016-02-24, 00:46

I could not find any instructions for how to run Pale Moon on OpenBSD so I made my own.
What follows are my notes in a fairly terse format. If you run OpenBSD, I think you'll be able to follow along... :^)

Code: Select all

  see also (this was my starting point):

  hardware & OS:

    OpenBSD version 5.8 64-bit (amd64 architecture) is what I used.

    My build system has 4GB of RAM and an equal amount of swap space.

    32-bit OpenBSD has problems accessing enough RAM to link libxul.  This is
    because there is a per process limit of RAM that cannot be overcome.  I
    think it's around ~1GB (?).  I'm not too clear on the details but I know I
    tried and it always failed with a "memory exhausted" error (anyone able to
    get around this problem?)...


    required packages:

      # find your best mirror here:
      export PKG_PATH=`uname -r`/packages/`machine -a`/
      pkg_add -v -i autoconf-2.13p3 bash dbus-glib g++-4.8.4p2 gmake \
                    gtk+2-2.24.28 p7zip py-virtualenv wget yasm libvpx

    package specific setup:

      ln -sf /usr/local/bin/bash      /bin/bash
      ln -sf /usr/local/bin/python2.7 /usr/local/bin/python

    required X11 OS "sets" (these come on the installation ISO too):

        NOTE: skip this section if you've already installed all X11 sets...
      if ! [ -f /usr/X11R6/lib/X11/fonts/misc/10x20.pcf.gz ] ; then
        cd /tmp
          V=$(echo `uname -r` | sed 's/\.//')
          wget -nd`uname -r`/`machine -a`/xfont$V.tgz
          cd /
            tar xzvphf /tmp/xfont$V.tgz
            /bin/rm -f /tmp/xfont$V.tgz

      if ! [ -x /usr/X11R6/bin/startx ] ; then
        cd /tmp
          V=$(echo `uname -r` | sed 's/\.//')
          wget -nd`uname -r`/`machine -a`/xshare$V.tgz
          cd /
            tar xzvphf /tmp/xshare$V.tgz
            /bin/rm -f /tmp/xshare$V.tgz

  get and extract the PM source:

    mkdir -p ~/tmp/pm/{pmsrc,pmbuild}
    cd       ~/tmp/pm

      wget -nd

      7za x *.7z -o'pmsrc'

      chmod -R +x pmsrc/*

  prep the build system:



      if [ ! -d "pmsrc" ] || [ ! -d "pmbuild" ] || [ ! -f "mozconfig.txt" ] ; then
        echo "Check the directories and files!"
        exit 1

      cp mozconfig.txt pmsrc/.mozconfig
      cd pmsrc/

      export      CC='egcc'                  # use the updated compiler
      export     CXX='eg++'                  # use the updated compiler
      #xport LDFLAGS='-Wl,--no-keep-memory'  # save RAM while linking

      gmake -f build &> /dev/stdout | tee buildlog.txt

      if [ ${PIPESTATUS[0]} == 0 ]; then
        cd "../pmbuild"
        gmake package

    vi mozconfig.txt

      ac_add_options --enable-official-branding
      export MOZILLA_OFFICIAL=1

      mk_add_options MOZ_CO_PROJECT=browser
      ac_add_options --enable-application=browser

      mk_add_options MOZ_OBJDIR=/root/tmp/pm/pmbuild/
      ac_add_options --x-libraries=/usr/X11R6/lib

      ac_add_options --disable-installer
      ac_add_options --disable-updater

      # The internal vpx fails to build with an error similar to (?):
      #   "Assembler messages" "no such instruction" "pinsrq"
      ac_add_options --with-system-libvpx

      ac_add_options --disable-tests
      ac_add_options --disable-mochitests
      ac_add_options --disable-debug

      ac_add_options --disable-necko-wifi
      ac_add_options --disable-webspeech
      ac_add_options --disable-webrtc

      # note: change -O3 to -O2 if using an even newer compiler...
      ac_add_options --enable-optimize="-O3 -msse2 -mfpmath=sse"
      ac_add_options --enable-strip

  gruesome hacks:

      NOTE: these are intended to be quick-and-dirty...  They could form the
            inspiration for some proper diffs in the future, but for now, just
            paste them in (only once as they may not be idempotent)...

    # the build system does not know about OpenBSD...
    [ -f pmsrc/python/psutil/psutil/ ] || \
      cp pmsrc/python/psutil/psutil/          \
    perl -p -i -e 's{freebsd}{openbsd5}' \

    # do not use malloc.h on OpenBSD...
    [ -f pmsrc/ ] || \
      cp pmsrc/          \
    perl -p -i -e 's{(?<=^MALLOC_HEADERS=").*(?=")}{}' \

    # fix missing defines...
    [ -f pmsrc/js/src/ ] || \
      cp pmsrc/js/src/jscpucfg.h          \
    perl -n -i -e 'print;'                                              \
               -e ' if ( /include <endian.h>/ ) {'                      \
               -e '  print "# define __BYTE_ORDER BYTE_ORDER\n";'       \
               -e '  print "# define __BIG_ENDIAN BIG_ENDIAN\n";'       \
               -e '  print "# define __LITTLE_ENDIAN LITTLE_ENDIAN\n";' \
               -e '}'                                                   \

    # fix missing defines...
    [ -f pmsrc/ipc/chromium/src/base/ ] || \
      cp pmsrc/ipc/chromium/src/base/          \
    perl -n -i -e 'print;'                                                      \
               -e ' if ( /P_TRACED flag is set/ ) {'                            \
               -e '  print "#if defined(OS_OPENBSD) && !defined(_P_TRACED)\n";' \
               -e '  print "#define KP_FLAGS p_psflags\n";'                     \
               -e '  print "#define P_TRACED PS_TRACED\n";'                     \
               -e '  print "#endif\n";'                                         \
               -e '}'                                                           \

    # disable some old cruft...
    [ -f pmsrc/ipc/chromium/src/base/ ] || \
      cp pmsrc/ipc/chromium/src/base/dir_reader_bsd.h          \
    perl -p -i -e 's{OS_OPENBSD}{SOME_NOOP}' \

    # OpenBSD does not have arc4random_addrandom()...
    [ -f pmsrc/ipc/chromium/src/third_party/libevent/ ] || \
      cp pmsrc/ipc/chromium/src/third_party/libevent/evutil_rand.c          \
    perl -p -i -e '/arc4random_addrandom/&&print"return;\n"' \

  start the actual build:



    ls ~/tmp/pm/pmbuild/dist/palemoon-*.en-US.openbsd5.8-x86_64.tar.bz2

  quick install notes (you may choose to do this differently):


    [ -d /opt ] || mkdir /opt
    cd /opt
      tar xvjf ~/tmp/pm/pmbuild/dist/palemoon-$PM_VER.en-US.openbsd5.8-x86_64.tar.bz2
      mv palemoon palemoon$PM_VER
      ln -sf /opt/palemoon$PM_VER/palemoon /usr/local/bin/palemoon

        NOTE: you can now run /usr/local/bin/palemoon.  Ignore this bogon:

                WARNING: symbol(_ZN11__gnu_debug17_S_debug_messagesE) size mismatch...