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):
http://linux.palemoon.org/help/build
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?)...
pre-reqs:
required packages:
#
# find your best mirror here:
#
# http://www.openbsd.org/ftp.html
#
export PKG_PATH=ftp://ftp3.usa.openbsd.org/pub/OpenBSD/`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 ftp://mirror.planetunix.net/pub/OpenBSD/`uname -r`/`machine -a`/xfont$V.tgz
cd /
tar xzvphf /tmp/xfont$V.tgz
/bin/rm -f /tmp/xfont$V.tgz
fi
if ! [ -x /usr/X11R6/bin/startx ] ; then
cd /tmp
V=$(echo `uname -r` | sed 's/\.//')
wget -nd ftp://mirror.planetunix.net/pub/OpenBSD/`uname -r`/`machine -a`/xshare$V.tgz
cd /
tar xzvphf /tmp/xshare$V.tgz
/bin/rm -f /tmp/xshare$V.tgz
fi
get and extract the PM source:
mkdir -p ~/tmp/pm/{pmsrc,pmbuild}
cd ~/tmp/pm
#
# http://www.palemoon.org/sourcecode.shtml
#
wget -nd ftp://source:current@ftp.palemoon.org/palemoon-26.1.0-source.7z
7za x *.7z -o'pmsrc'
chmod -R +x pmsrc/*
prep the build system:
vi build.sh
#!/bin/bash
if [ ! -d "pmsrc" ] || [ ! -d "pmbuild" ] || [ ! -f "mozconfig.txt" ] ; then
echo "Check the directories and files!"
exit 1
fi
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 client.mk build &> /dev/stdout | tee buildlog.txt
if [ ${PIPESTATUS[0]} == 0 ]; then
cd "../pmbuild"
gmake package
fi
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/__init__.py.org ] || \
cp pmsrc/python/psutil/psutil/__init__.py \
pmsrc/python/psutil/psutil/__init__.py.org
perl -p -i -e 's{freebsd}{openbsd5}' \
pmsrc/python/psutil/psutil/__init__.py
#
# do not use malloc.h on OpenBSD...
#
[ -f pmsrc/configure.in.org ] || \
cp pmsrc/configure.in \
pmsrc/configure.in.org
perl -p -i -e 's{(?<=^MALLOC_HEADERS=").*(?=")}{}' \
pmsrc/configure.in
#
# fix missing defines...
#
[ -f pmsrc/js/src/jscpucfg.h.org ] || \
cp pmsrc/js/src/jscpucfg.h \
pmsrc/js/src/jscpucfg.h.org
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 '}' \
pmsrc/js/src/jscpucfg.h
#
# fix missing defines...
#
[ -f pmsrc/ipc/chromium/src/base/debug_util_posix.cc.org ] || \
cp pmsrc/ipc/chromium/src/base/debug_util_posix.cc \
pmsrc/ipc/chromium/src/base/debug_util_posix.cc.org
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 '}' \
pmsrc/ipc/chromium/src/base/debug_util_posix.cc
#
# disable some old cruft...
#
[ -f pmsrc/ipc/chromium/src/base/dir_reader_bsd.h.org ] || \
cp pmsrc/ipc/chromium/src/base/dir_reader_bsd.h \
pmsrc/ipc/chromium/src/base/dir_reader_bsd.h.org
perl -p -i -e 's{OS_OPENBSD}{SOME_NOOP}' \
pmsrc/ipc/chromium/src/base/dir_reader_bsd.h
#
# OpenBSD does not have arc4random_addrandom()...
#
# https://bugzilla.mozilla.org/show_bug.cgi?id=931354
#
[ -f pmsrc/ipc/chromium/src/third_party/libevent/evutil_rand.c.org ] || \
cp pmsrc/ipc/chromium/src/third_party/libevent/evutil_rand.c \
pmsrc/ipc/chromium/src/third_party/libevent/evutil_rand.c.org
perl -p -i -e '/arc4random_addrandom/&&print"return;\n"' \
pmsrc/ipc/chromium/src/third_party/libevent/evutil_rand.c
start the actual build:
bash build.sh
result:
ls ~/tmp/pm/pmbuild/dist/palemoon-*.en-US.openbsd5.8-x86_64.tar.bz2
quick install notes (you may choose to do this differently):
PM_VER=26.1.0
[ -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...
http://marc.info/?l=openbsd-misc&m=141149797207874