Tuesday 7 December 2010

LFS - Popular Dependencies

I have installed a number of bits of software onto my bare LFS/X/GTK system now, and I have noticed that I have come across the same dependencies time and again. I have installed Firefox, OpenOffice and a number of smaller applications, all of which shared to an extent background software. So, for the next build, I thought it would be a good idea to stick all of that software into a blogpost so I have a record of the shared stuff, so I can install it all in a one-er and then get on with the applications themselves.

First of all, there are a few packages which crop up and I keep having to double check that I have installed them. I have, because they form part of the core system. They are:

Installed with LFS
zlib
libuuid

Installed Basics
zip
unzip
lzma
openssl

Installed with Xorg:
XML::Parser
Intltool
libpng (and yes I applied the patch to allow it to be used with Firefox)
Fontconfig
Pixman

Installed with GTK:
Cairo
Pango
PCRE
tiff
jpeg

I do not need to worry about those again, they are already installed. So what is not, and what is the best order to install these extras in? I think first of all we will install some programs that do not depend on any of the other packages we are about to dump into the system. SQLite is a database program and startup-notification makes the pointer do the hourglass thing while another program is starting up. For some programs, unbelievably this is actually a prerequisite.

I am going to stick all of these source files in a separate folder in sources - this is just to show that they are not part of the structure of LFS, and neither are they the Applications that I will end up running.

mkdir /sources/dependencies
cd /sources/dependencies
wget http://ftp.gnome.org/pub/gnome/sources/startup-notification/0.9/startup-notification-0.9.tar.bz2
wget http://sqlite.org/sqlite-amalgamation-3.7.3.tar.gz

cd /dev/shm
tar -xjvf /sources/dependencies/startup-notification-0.9.tar.bz2
cd startup-notification-0.9
./configure --prefix=/usr &&
make $CORES_TO_USE
make install &&
install -v -m644 -D doc/startup-notification.txt /usr/share/doc/startup-notification-0.9/startup-notification.txt
cd ..
rm -rvf startup-notification-0.9

tar -xzvf /sources/dependencies/sqlite-amalgamation-3.7.3.tar.gz
cd sqlite-3.7.3
CFLAGS="-g -O2 -DSQLITE_SECURE_DELETE -DSQLITE_ENABLE_UNLOCK_NOTIFY=1" ./configure --prefix=/usr --enable-threadsafe --enable-readline --enable-dynamic-extensions &&
make $CORES_TO_USE
make install
cd ..
rm -rvf sqlite-3.7.3

Lets move on to a biggie which is the Python language. A number of applications use this, as do some of the intermediate libraries.

cd /sources/dependencies
wget http://www.python.org/ftp/python/2.6.4/Python-2.6.4.tar.bz2
wget http://www.linuxfromscratch.org/patches/blfs/svn/Python-2.6.4-bdb_4.8-1.patch
wget http://docs.python.org/ftp/python/doc/2.6/python-2.6-docs-html.tar.bz2

cd /dev/shm
tar -xjvf /sources/dependencies/Python-2.6.4.tar.bz2
cd Python-2.6.4
sed -i "s/ndbm_libs = \[\]/ndbm_libs = ['gdbm', 'gdbm_compat']/" setup.py
patch -Np1 -i /sources/dependencies/Python-2.6.4-bdb_4.8-1.patch
./configure --prefix=/usr --enable-shared
make $CORES_TO_USE
make install
chmod -v 755 /usr/lib/libpython2.6.so.1.0
install -v -m755 -d /usr/share/doc/Python-2.6.4/html
tar --strip-components=1 --no-same-owner --no-same-permissions -C /usr/share/doc/Python-2.6.4/html -xvf /sources/dependencies/python-2.6-docs-html.tar.bz2
cat >> /etc/profile.d/35-python.sh << "EOF"
export PYTHONDOCS=/usr/share/doc/Python-2.6.4/html
EOF
cd ..
rm -rvf Python-2.6.4

Right, now it is time for some hot library action:

cd /sources/dependencies
wget http://ftp.gnome.org/pub/gnome/sources/libIDL/0.8/libIDL-0.8.14.tar.bz2
wget http://xmlsoft.org/sources/libxml2-2.7.6.tar.gz
wget http://xmlsoft.org/sources/libxslt-1.1.26.tar.gz
wget ftp://sourceware.org/pub/libffi/libffi-3.0.8.tar.gz
wget http://ftp.gnome.org/pub/gnome/sources/libglade/2.6/libglade-2.6.4.tar.bz2

cd /dev/shm
tar -xjvf /sources/dependencies/libIDL-0.8.14.tar.bz2
cd libIDL-0.8.14
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf libIDL-0.8.14

tar -xzvf /sources/dependencies/libxml2-2.7.6.tar.gz
cd libxml2-2.7.6
./configure --prefix=/usr
make $CORES_TO_USE
make install
cd ..
rm -rvf libxml2-2.7.6

tar -xzvf /sources/dependencies/libxslt-1.1.26.tar.gz
cd libxslt-1.1.26
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf libxslt-1.1.26

tar -xzvf /sources/dependencies/libffi-3.0.8.tar.gz
cd libffi-3.0.8
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf libffi-3.0.8

tar -jxvf /sources/dependencies/libglade-2.6.4.tar.bz2
cd libglade-2.6.4
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf libglade-2.6.4

Still on the libraries front, we installed Glib, Cairo, Pango and GTK. Some applications need GTK to be able to speak C++ so we need to install the following crossover libraries (the libsigc++ is needed for glibmm). Note that this project has taken so long that I am now out of date with my version of glib. I had to update it before I could install glibmm. I also had to update gtk+2 and ATK, but not cairo or pango. I will write up a new GTK+2 installation post to bring the installation up to date.

cd /sources/dependencies
wget http://cairographics.org/releases/cairomm-1.6.2.tar.gz
wget http://ftp.gnome.org/pub/gnome/sources/libsigc++/2.2/libsigc++-2.2.8.tar.bz2
wget http://ftp.gnome.org/pub/gnome/sources/glibmm/2.24/glibmm-2.24.2.tar.bz2
wget http://ftp.gnome.org/pub/gnome/sources/pangomm/2.26/pangomm-2.26.2.tar.bz2
wget http://ftp.gnome.org/pub/gnome/sources/gtkmm/2.20/gtkmm-2.20.3.tar.bz2

cd /dev/shm
tar -xzvf /sources/dependencies/cairomm-1.6.2.tar.gz
cd cairomm-1.6.2
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf cairomm-1.6.2

tar -xjvf /sources/dependencies/libsigc++-2.2.8.tar.bz2
cd libsigc++-2.2.8
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf libsigc++-2.2.8

tar -xjvf /sources/dependencies/glibmm-2.24.2.tar.bz2
cd glibmm-2.24.2
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf glibmm-2.24.2

tar -xjvf /sources/dependencies/pangomm-2.26.2.tar.bz2
cd pangomm-2.26.2
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf pangomm-2.26.2

tar -xjvf /sources/dependencies/gtkmm-2.20.3.tar.bz2
cd gtkmm-2.20.3
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf gtkmm-2.20.3

The next set are modules which plug in to the Python and give it access to GTK.

cd /sources/dependencies
wget http://ftp.gnome.org/pub/gnome/sources/gobject-introspection/0.6/gobject-introspection-0.6.14.tar.bz2
wget http://ftp.gnome.org/pub/gnome/sources/pygobject/2.21/pygobject-2.21.3.tar.bz2
wget http://cairographics.org/releases/pycairo-1.8.8.tar.gz
wget http://ftp.gnome.org/pub/GNOME/sources/pygtk/2.17/pygtk-2.17.0.tar.bz2
wget http://downloads.sourceforge.net/pyxml/PyXML-0.8.4.tar.gz
wget http://ftp.gnome.org/pub/gnome/sources/gtksourceview/2.10/gtksourceview-2.10.4.tar.bz2
wget http://ftp.gnome.org/pub/gnome/sources/pygtksourceview/2.10/pygtksourceview-2.10.1.tar.bz2

cd /dev/shm
tar -xjvf /sources/dependencies/gobject-introspection-0.6.14.tar.bz2
cd gobject-introspection-0.6.14
./configure --prefix=/usr --disable-tests &&
make $CORES_TO_USE
make install
cd ..
rm -rvf gobject-introspection-0.6.14

tar -xjvf /sources/dependencies/pygobject-2.21.3.tar.bz2
cd pygobject-2.21.3
./configure --prefix=/usr
make $CORES_TO_USE
make install
cd ..
rm -rvf pygobject-2.21.3

tar -xzvf /sources/dependencies/pycairo-1.8.8.tar.gz
cd pycairo-1.8.8
./configure --prefix=/usr
make $CORES_TO_USE
make install
cd ..
rm -rvf pycairo-1.8.8

tar -xjvf /sources/dependencies/pygtk-2.17.0.tar.bz2
cd pygtk-2.17.0
./configure --prefix=/usr
make $CORES_TO_USE
make install
cd ..
rm -rvf pygtk-2.17.0

tar -xzvf /sources/dependencies/PyXML-0.8.4.tar.gz
cd PyXML-0.8.4
python setup.py build
python setup.py install &&
install -v -m644 doc/man/xmlproc_*.1 /usr/share/man/man1 &&
install -v -m755 -d /usr/share/doc/PyXML-0.8.4 &&
cp -v -R doc demo test /usr/share/doc/PyXML-0.8.4 &&
install -v -m644 README* /usr/share/doc/PyXML-0.8.4
cd ..
rm -rvf PyXML-0.8.4

tar -xjvf /sources/dependencies/gtksourceview-2.10.4.tar.bz2
cd gtksourceview-2.10.4
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf gtksourceview-2.10.4

tar -xjvf /sources/dependencies/pygtksourceview-2.10.1.tar.bz2
cd pygtksourceview-2.10.1
./configure --prefix=/usr --disable-docs &&
make $CORES_TO_USE
make install
cd ..
rm -rvf pygtksourceview-2.10.1

Sticking with the previous theme, we also need to install some modules for Perl:

cd /sources/dependencies
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/Archive-Zip-1.20.tar.gz
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/IO-Compress-Base-2.005.tar.gz
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/Compress-Raw-Bzip2-2.005.tar.gz
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/IO-Compress-Bzip2-2.005.tar.gz
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/Compress-Raw-Zlib-2.005.tar.gz
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/IO-Compress-Zlib-2.005.tar.gz
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules/Compress-Zlib-2.005.tar.gz

cd /dev/shm
tar -xzvf /sources/dependencies/IO-Compress-Base-2.005.tar.gz
cd  IO-Compress-Base-2.005
perl Makefile.PL &&
make &&
make install
cd ..
rm -rvf  IO-Compress-Base-2.005

tar -xzvf /sources/dependencies/Compress-Raw-Bzip2-2.005.tar.gz
cd  Compress-Raw-Bzip2-2.005
perl Makefile.PL &&
make &&
make install
cd ..
rm -rvf  Compress-Raw-Bzip2-2.005

tar -xzvf /sources/dependencies/IO-Compress-Bzip2-2.005.tar.gz
cd  IO-Compress-Bzip2-2.005
perl Makefile.PL &&
make &&
make install
cd ..
rm -rvf  IO-Compress-Bzip2-2.005

tar -xzvf /sources/dependencies/Compress-Raw-Zlib-2.005.tar.gz
cd  Compress-Raw-Zlib-2.005
sed -i -e "s|BUILD_ZLIB\s*= True|BUILD_ZLIB = False|" -e "s|INCLUDE\s*= ./zlib-src|INCLUDE    = /usr/include|" -e "s|LIB\s*= ./zlib-src|LIB        = /usr/lib|" config.in
perl Makefile.PL &&
make &&
make install
cd ..
rm -rvf  Compress-Raw-Zlib-2.005

tar -xzvf /sources/dependencies/IO-Compress-Zlib-2.005.tar.gz
cd  IO-Compress-Zlib-2.005
perl Makefile.PL &&
make &&
make install
cd ..
rm -rvf  IO-Compress-Zlib-2.005

tar -xzvf /sources/dependencies/Compress-Zlib-2.005.tar.gz
cd  Compress-Zlib-2.005
perl Makefile.PL &&
make &&
make install
cd ..
rm -rvf  Compress-Zlib-2.005

tar -xzvf /sources/dependencies/Archive-Zip-1.20.tar.gz
cd  Archive-Zip-1.20
perl Makefile.PL &&
make &&
make install
cd ..
rm -rf  Archive-Zip-1.20

Now we need some applications which are regularly relied on:

cd /sources/dependencies
wget ftp://ftp.gnu.org/gnu/which/which-2.20.tar.gz
wget http://curl.haxx.se/download/curl-7.20.0.tar.bz2

cd /dev/shm
tar -xzvf /sources/dependencies/which-2.20.tar.gz
cd which-2.20
./configure --prefix=/usr &&
make $CORES_TO_USE
make install
cd ..
rm -rvf which-2.20

tar -xjvf /sources/dependencies/curl-7.20.0.tar.bz2
cd curl-7.20.0
./configure --prefix=/usr
make $CORES_TO_USE
make install
find docs -name "Makefile*" -o -name "*.1" -o -name "*.3" | xargs rm
install -v -d -m755 /usr/share/doc/curl-7.20.0
cp -v -R docs/* /usr/share/doc/curl-7.20.0
cd ..
rm -rvf curl-7.20.0

And some C++ stuff which I am a little in the dark about.

cd /sources/dependencies
wget http://downloads.sourceforge.net/boost/boost-jam-3.1.17.tgz
wget http://downloads.sourceforge.net/boost/boost_1_37_0.tar.bz2
cd /dev/shm
tar -xzvf /sources/dependencies/boost-jam-3.1.17.tgz
cd boost-jam-3.1.17
./build.sh
cd bin.linux* &&
cp -v bjam /usr/bin
cd ..
rm -rvf boost-jam-3.1.17

tar -xjvf /sources/dependencies/boost_1_37_0.tar.bz2
cd boost_1_37_0
./configure --prefix=/usr --with-toolset=gcc --with-bjam=/usr/bin/bjam &&
make $CORES_TO_USE
make install &&
ln -sfnv boost-1_37/boost /usr/include/boost
cd ..
rm -rvf boost_1_37_0

Some security libraries (and a stand alone SQLite database to support them:

cd /sources/dependencies
wget http://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v4.8.6/src/nspr-4.8.6.tar.gz
wget http://www.linuxfromscratch.org/patches/blfs/svn/nspr-4.8.6-pkgconfig-1.patch
wget http://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_12_4_RTM/src/nss-3.12.4.tar.gz
wget http://svn.cross-lfs.org/svn/repos/patches/nss/nss-3.12.4-fixes-1.patch
wget http://cross-lfs.org/~jciccone/nss-3.12-r5-config.in

cd /dev/shm

tar -xzvf /sources/dependencies/nspr-4.8.6.tar.gz
cd nspr-4.8.6
patch -Np1 -i /sources/dependencies/nspr-4.8.6-pkgconfig-1.patch &&
cd mozilla/nsprpub &&
./configure --prefix=/usr --with-mozilla --with-pthreads &&
make $CORES_TO_USE
make install &&
cp -v -LR dist/include/nspr /usr/include &&
rm -v -f /usr/bin/{prerr.properties,compile-et.pl}
cd ../../..
rm -rvf nspr-4.8.6

tar -xzvf /sources/dependencies/nss-3.12.4.tar.gz
cd nss-3.12.4
patch -Np0 -i /sources/dependencies/nss-3.12.4-fixes-1.patch &&
sed -i 's@\$(MKSHLIB) -o@\$(MKSHLIB) \$(LDFLAGS) -o@g' mozilla/security/coreconf/rules.mk &&
for dir in mozilla/security/{coreconf,dbm,nss}; do
  make -C $dir  BUILD_OPT=1 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 NSPR_INCLUDE_DIR=$(pkg-config --variable=includedir nspr) NSPR_LIB_DIR=$(pkg-config --variable=libdir nspr) FREEBL_NO_DEPEND=1 || break
done
for file in libsoftokn3.so libfreebl3.so libnss3.so libnssutil3.so libssl3.so libsmime3.so libnssckbi.so libnssdbm3.so; do
  install -m755 mozilla/dist/*.OBJ/lib/${file} /usr/lib
done
for file in libcrmf.a libnssb.a libnssckfw.a; do
  install -m644 mozilla/dist/*.OBJ/lib/${file} /usr/lib
done
for file in certutil cmsutil crlutil modutil pk12util signtool signver ssltap; do
  install -m755 mozilla/dist/*.OBJ/bin/${file} /usr/bin
done
install -m755 -d /usr/include/nss3
install -m644 mozilla/dist/public/nss/*.h /usr/include/nss3 &&
ln -sfv nss3 /usr/include/nss
cat > /usr/lib/pkgconfig/nss.pc << "EOF"
prefix=/usr
exec_prefix=/usr/bin
libdir=/usr/lib
includedir=/usr/include/nss3

Name: NSS
Description: Network Security Services
Version: 3.12.4
Requires: sqlite3 nspr >= 4.8
Libs: -L${libdir} -lssl3 -lsmime3 -lnss3 -lnssutil3
Cflags: -I${includedir}
EOF

chmod 644 /usr/lib/pkgconfig/nss.pc
ln -sfv nss.pc /usr/lib/pkgconfig/mozilla-nss.pc

install -v -m755 /sources/dependencies/nss-3.12-r5-config.in /usr/bin/nss-config &&
sed -i -e "s/@MOD_MAJOR_VERSION@/3/" -e "s/@MOD_MINOR_VERSION@/12/" -e "s/@MOD_PATCH_VERSION@/3/" -e "s/@prefix@/\/usr/" /usr/bin/nss-config

cd ..
rm -rvf nss-3.12.4

Lastly I am going to install some Java software including, stunningly, Java. Download the Java source from this link into the /sources/extras folder. Then run these commands:

cd /dev/shm
chmod +x /sources/extras/jdk-6u21-linux-i586.bin
/sources/extras/jdk-6u21-linux-i586.bin
cd jdk1.6.0_21
install -v -m755 -d /opt/jdk-6u21
mv -v * /opt/jdk-6u21
chown -v -R root:root /opt/jdk-6u21
ln -v -sf xawt/libmawt.so /opt/jdk-6u21/jre/lib/i386/
cd ..
sed -i 's@XINERAMA@FAKEEXTN@g' /opt/jdk-6u21/jre/lib/i386/xawt/libmawt.so
ln -v -nsf jdk-6u21 /opt/jdk

cat >> /etc/profile.d/30-jdk.sh << "EOF"
# Begin /etc/profile.d/30-jdk.sh

# Set JAVA_HOME directory
JAVA_HOME=/opt/jdk

# Adjust PATH
pathappend ${JAVA_HOME}/bin PATH

# Auto Java CLASSPATH
# Copy jar files to, or create symlinks in this directory
AUTO_CLASSPATH_DIR=/usr/lib/classpath
pathprepend . CLASSPATH
for dir in `find ${AUTO_CLASSPATH_DIR} -type d 2>/dev/null`; do
pathappend $dir CLASSPATH
done

export JAVA_HOME CLASSPATH
unset AUTO_CLASSPATH_DIR
unset dir

# End /etc/profile.d/30-jdk.sh
EOF

source /etc/profile

JUnit is not, as you may be forgiven for assuming, a boy band. It is, instead, a small Java application that allows various tests to be run on other Java applications, such as Apache Ant which is a Java based alternative to [make] and OpenOffice.org, amongst others, is going to use it to compile.

cd /sources/dependencies
wget http://downloads.sourceforge.net/junit/junit4.8.1.zip
wget http://anduin.linuxfromscratch.org/sources/BLFS/svn/a/apache-ant-1.8.1-src.tar.bz2

cd /dev/shm
unzip /sources/dependencies/junit4.8.1.zip
cd junit4.8.1
install -v -m755 -d /usr/share/{,doc/}junit-4.8.1 &&
chown -R root:root . &&
cp -v -R junit* org  /usr/share/junit-4.8.1 &&
cp -v -R *.html *doc /usr/share/doc/junit-4.8.1
export CLASSPATH=$CLASSPATH:/usr/share/junit-4.8.1/junit-4.8.1.jar:/usr/share/junit-4.8.1
cd ..
rm -rvf junit4.8.1

tar -jxvf /sources/dependencies/apache-ant-1.8.1-src.tar.bz2
cd apache-ant-1.8.1
sed -i 's|${dist.dir}/etc|/etc/ant|'        build.xml &&
sed -i 's|/etc/ant.conf|/etc/ant/ant.conf|' src/script/ant &&
cp -v /usr/share/junit-4.8.1/junit-4.8.1.jar lib/optional/junit.jar
./build.sh -Ddist.dir=/opt/ant-1.8.1 dist &&
ln -v -sf /etc/ant /opt/ant-1.8.1/etc &&
ln -v -sf ant-1.8.1 /opt/ant
cd ..
rm -rvf apache-ant-1.8.1

1 comment:

  1. Thank you! I found you through the Dependency Hell post, trying to install PyGTK, little suspecting that only TINY EXACT VERSION INCREMENTS had any prayer of working. I'm going to have to read through the rest of this blog to see if you've tackled Nautilus, because that is giving me hairballs, too (mostly "libunique-1.0" which seems to be unable to build because unique-1.0 isn't found in the lib path. sigh.)

    ReplyDelete