source: common/libs/func_install_blfs@ 6cf9d46

ablfs
Last change on this file since 6cf9d46 was 7ea25e4, checked in by Pierre Labastie <pierre@…>, 13 years ago

Add new functions for the blfs tool dependencies

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