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