[7ea25e4] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | # $Id$
|
---|
| 4 |
|
---|
| 5 | #----------------------------# Prepare BLFS_ROOT and extract
|
---|
| 6 | install_blfs_tools() { # the scriptlets to build
|
---|
| 7 | #----------------------------# the dependency tools
|
---|
[b35ce44] | 8 | set -e
|
---|
[7ea25e4] | 9 | # Install the files
|
---|
| 10 | [[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -pv ${BUILDDIR}${BLFS_ROOT}
|
---|
| 11 | cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
|
---|
| 12 | cp -r menu ${BUILDDIR}${BLFS_ROOT}
|
---|
| 13 | cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
|
---|
| 14 | cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
|
---|
| 15 |
|
---|
| 16 | # Clean-up
|
---|
| 17 | make -C ${BUILDDIR}${BLFS_ROOT}/menu clean
|
---|
| 18 | rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
|
---|
| 19 | rm -rf ${BUILDDIR}${BLFS_ROOT}/xsl/.svn
|
---|
| 20 | rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
|
---|
| 21 | rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
|
---|
| 22 |
|
---|
| 23 | # Set some harcoded envars to their proper values
|
---|
| 24 | sed -i s@tracking-dir@$TRACKING_DIR@ \
|
---|
| 25 | ${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh}
|
---|
| 26 |
|
---|
| 27 | # Downloads the book, initialize the tracking file and the package database
|
---|
[81cd513] | 28 | # sudo is needed if $BUILDDIR/var/lib is owned by root and /var/lib/jhalfs
|
---|
| 29 | # has to be created
|
---|
| 30 | sudo make -j1 -C $BUILDDIR$BLFS_ROOT TRACKING_DIR=$BUILDDIR$TRACKING_DIR \
|
---|
[7ea25e4] | 31 | $BUILDDIR$BLFS_ROOT/packages.xml
|
---|
| 32 |
|
---|
| 33 | # Because the BLFS Makefile is supposed to be used in chroot (or booted)
|
---|
| 34 | # mode, the tracking file has wrong path for DTD. Change it:
|
---|
[5573313] | 35 | sudo sed -i s@$BUILDDIR@@ $BUILDDIR$TRACKING_DIR/instpkg.xml
|
---|
[7ea25e4] | 36 |
|
---|
| 37 | # Manually build a 'configuration' file
|
---|
| 38 | if [ "$DEP_LIBXML" = y ]; then
|
---|
| 39 | LINE_LIBXML='CONFIG_libxml2=y'
|
---|
| 40 | else
|
---|
| 41 | LINE_LIBXML='#CONFIG_libxml2 is not set'
|
---|
| 42 | fi
|
---|
| 43 | if [ "$DEP_LIBXSLT" = y ]; then
|
---|
| 44 | LINE_LIBXSLT='CONFIG_libxslt=y'
|
---|
| 45 | else
|
---|
| 46 | LINE_LIBXSLT='#CONFIG_libxslt is not set'
|
---|
| 47 | fi
|
---|
| 48 | if [ "$DEP_TIDY" = y ]; then
|
---|
| 49 | LINE_TIDY='CONFIG_html-tidy=y'
|
---|
| 50 | else
|
---|
| 51 | LINE_TIDY='#CONFIG_html-tidy is not set'
|
---|
| 52 | fi
|
---|
| 53 | if [ "$DEP_DBXML" = y ]; then
|
---|
| 54 | LINE_DBXML='CONFIG_DocBook=y'
|
---|
| 55 | else
|
---|
| 56 | LINE_DBXML='#CONFIG_DocBook is not set'
|
---|
| 57 | fi
|
---|
| 58 | if [ "$DEP_LYNX" = y ]; then
|
---|
| 59 | LINE_LYNX='CONFIG_lynx=y'
|
---|
| 60 | else
|
---|
| 61 | LINE_LYNX='#CONFIG_lynx is not set'
|
---|
| 62 | fi
|
---|
| 63 | if [ "$DEP_SUDO" = y ]; then
|
---|
| 64 | LINE_SUDO='CONFIG_sudo=y'
|
---|
| 65 | else
|
---|
| 66 | LINE_SUDO='#CONFIG_sudo is not set'
|
---|
| 67 | fi
|
---|
| 68 | if [ "$DEP_WGET" = y ]; then
|
---|
| 69 | LINE_WGET='CONFIG_wget=y'
|
---|
| 70 | else
|
---|
| 71 | LINE_WGET='#CONFIG_wget is not set'
|
---|
| 72 | fi
|
---|
| 73 | if [ "$DEP_GPM" = y ]; then
|
---|
| 74 | LINE_GPM='CONFIG_gpm=y'
|
---|
| 75 | else
|
---|
| 76 | LINE_GPM='#CONFIG_gpm is not set'
|
---|
| 77 | fi
|
---|
| 78 | if [ "$DEP_SVN" = y ]; then
|
---|
| 79 | LINE_SVN='CONFIG_subversion=y'
|
---|
| 80 | else
|
---|
| 81 | LINE_SVN='#CONFIG_subversion is not set'
|
---|
| 82 | fi
|
---|
[de947d2] | 83 | if [ "$DEP_OPENSSL" = y ]; then
|
---|
| 84 | LINE_OPENSSL='CONFIG_openssl=y'
|
---|
| 85 | else
|
---|
| 86 | LINE_OPENSSL='#CONFIG_openssl is not set'
|
---|
| 87 | fi
|
---|
| 88 | if [ "$DEP_PYTHON" = y ]; then
|
---|
| 89 | LINE_PYTHON='CONFIG_python2=y'
|
---|
| 90 | else
|
---|
| 91 | LINE_PYTHON='#CONFIG_python2 is not set'
|
---|
| 92 | fi
|
---|
[7ea25e4] | 93 |
|
---|
| 94 | cat >$BUILDDIR$BLFS_ROOT/configuration <<EOF
|
---|
[de947d2] | 95 | $LINE_PYTHON
|
---|
[7ea25e4] | 96 | $LINE_LIBXML
|
---|
| 97 | $LINE_LIBXSLT
|
---|
| 98 | $LINE_TIDY
|
---|
| 99 | $LINE_DBXML
|
---|
[de947d2] | 100 | $LINE_OPENSSL
|
---|
[d6f2ebf] | 101 | $LINE_WGET
|
---|
[7ea25e4] | 102 | $LINE_SVN
|
---|
| 103 | $LINE_GPM
|
---|
| 104 | $LINE_LYNX
|
---|
| 105 | $LINE_SUDO
|
---|
| 106 | MAIL_SERVER=sendmail
|
---|
| 107 | optDependency=2
|
---|
| 108 | SUDO=n
|
---|
| 109 | EOF
|
---|
| 110 |
|
---|
| 111 | # Generates the scripts for the blfs tools dependencies (in ./scripts)
|
---|
| 112 | yes "yes" | $BUILDDIR$BLFS_ROOT/gen_pkg_book.sh $BUILDDIR$BLFS_ROOT
|
---|
| 113 |
|
---|
| 114 | # Move the scriptlets where they should be
|
---|
[b35ce44] | 115 | sudo rm -rf $BUILDDIR$BLFS_ROOT/scripts
|
---|
[7ea25e4] | 116 | mv scripts $BUILDDIR$BLFS_ROOT
|
---|
| 117 |
|
---|
| 118 | # Generates a list containing download and copying instructions for tarballs
|
---|
| 119 | echo -e '#!/bin/bash\nset -e\n' > $BUILDDIR$BLFS_ROOT/download_script
|
---|
| 120 | sed -n -e '/PACKAGE=/,/md5sum/p' \
|
---|
| 121 | -e '/PACKAGE1=/,/^fi/p' \
|
---|
| 122 | -e '/PATCH=/,/^fi/p' \
|
---|
| 123 | -e '/URL=/,/unpacked/p' \
|
---|
| 124 | $BUILDDIR$BLFS_ROOT/scripts/* >> $BUILDDIR$BLFS_ROOT/download_script
|
---|
| 125 | chmod u+x $BUILDDIR$BLFS_ROOT/download_script
|
---|
| 126 |
|
---|
| 127 | # Downloads (or copy) to build_dir/sources
|
---|
| 128 | pushd $BUILDDIR/sources
|
---|
[b35ce44] | 129 | # Remove `unpacked' files if some have been left
|
---|
| 130 | sudo find . -name unpacked -exec rm \{\} \;
|
---|
[7ea25e4] | 131 | FTP_SERVER=$SERVER/pub/blfs/ SRC_ARCHIVE=$SRC_ARCHIVE $BUILDDIR$BLFS_ROOT/download_script
|
---|
| 132 | # The blfs-bootscripts package is at the wrong location
|
---|
| 133 | mkdir -p blfs-bootscripts
|
---|
[b35ce44] | 134 | cp blfs-bootscripts*tar* blfs-bootscripts
|
---|
[7ea25e4] | 135 | popd
|
---|
| 136 | rm -v $BUILDDIR$BLFS_ROOT/download_script
|
---|
| 137 |
|
---|
| 138 | # Suppresses unneeded parts of the scriptlets
|
---|
[d6f2ebf] | 139 | if [ "$DEP_WGET" = y ] && ! [ "$DEP_OPENSSL" = y ]; then
|
---|
[7ea25e4] | 140 | sed -i s'/-ssl=.*/out-ssl/' $BUILDDIR$BLFS_ROOT/scripts/*wget
|
---|
| 141 | fi
|
---|
| 142 | if [ "$DEP_SUDO" = y ]; then
|
---|
| 143 | sed -i '/pam.d/i mkdir -p /etc/pam.d' $BUILDDIR$BLFS_ROOT/scripts/*sudo
|
---|
| 144 | fi
|
---|
| 145 | if [ "$DEP_SVN" = y ]; then
|
---|
| 146 | sed -i -e /javahl/d -e /swig/d $BUILDDIR$BLFS_ROOT/scripts/*subversion
|
---|
[b35ce44] | 147 | sed -i -e '/pushd/,/popd/d' -e /tea/d $BUILDDIR$BLFS_ROOT/scripts/*sqlite
|
---|
[7ea25e4] | 148 | fi
|
---|
[de947d2] | 149 | if [ "$DEP_PYTHON" = y ]; then
|
---|
| 150 | sed -i -e '/^make.*Doc/d' -e '/^chmod/{n;N;d}' $BUILDDIR$BLFS_ROOT/scripts/*python2
|
---|
| 151 | fi
|
---|
| 152 | if [ "$DEP_OPENSSL" = y ]; then
|
---|
| 153 | sed -i 's/^make$/make -j1/' $BUILDDIR$BLFS_ROOT/scripts/*openssl
|
---|
| 154 | fi
|
---|
[aefbe0f] | 155 | if [ "$DEP_LYNX" = y ]; then
|
---|
[7b9c8a0] | 156 | if [ "$DEP_OPENSSL" = y -o "$DEP_WGET" = y ]; then
|
---|
[aefbe0f] | 157 | sed -i -e 's/configure/& --with-ssl/' \
|
---|
[7b9c8a0] | 158 | -e '/make$/i echo "#define USE_OPENSSL_INCL 1" >> lynx_cfg.h &&' \
|
---|
[aefbe0f] | 159 | $BUILDDIR$BLFS_ROOT/scripts/*lynx
|
---|
| 160 | fi
|
---|
| 161 | fi
|
---|
[7ea25e4] | 162 | # At last generates the build Makefile
|
---|
| 163 | mkdir -p $BUILDDIR$BLFS_ROOT/work
|
---|
| 164 | pushd $BUILDDIR$BLFS_ROOT/work
|
---|
| 165 | ../gen-makefile.sh
|
---|
| 166 | sed -i -e '/xsltproc/,+6d' \
|
---|
| 167 | -e '/^all/s@$@ update@' \
|
---|
| 168 | -e 's/touch/@touch/' Makefile
|
---|
| 169 | cat >> Makefile << EOF
|
---|
| 170 | update:
|
---|
| 171 | @echo Updating the tracking file
|
---|
| 172 | @for file in *-*; do \\
|
---|
| 173 | xsltproc --stringparam packages ../packages.xml \\
|
---|
| 174 | --stringparam package \$\${file##*z-} \\
|
---|
| 175 | -o track.tmp \\
|
---|
| 176 | ../xsl/bump.xsl \$(TRACKING_FILE); \\
|
---|
| 177 | sed -i 's@PACKDESC@$BLFS_ROOT/packdesc.dtd@' track.tmp; \\
|
---|
| 178 | xmllint --format --postvalid track.tmp > \$(TRACKING_FILE); \\
|
---|
| 179 | rm track.tmp; \\
|
---|
| 180 | done
|
---|
| 181 | @touch \$@
|
---|
| 182 | @echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK
|
---|
| 183 | @echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
| 184 | EOF
|
---|
| 185 | popd
|
---|
| 186 | }
|
---|