source: common/libs/func_install_blfs@ 5795ad7

2.4 ablfs-more legacy new_features trunk
Last change on this file since 5795ad7 was e576789, checked in by Pierre Labastie <pierre@…>, 11 years ago

Merge ablfs branch. Normally, jhalfs should not perform differently
for building LFS

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