1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # $Id$
|
---|
4 |
|
---|
5 | #----------------------------# Hardcoded URLs and MD5.
|
---|
6 | add_blfs_deps_urls() { # No easy way to extract it.
|
---|
7 | #----------------------------# Some FTP mirrors may not work
|
---|
8 |
|
---|
9 | local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
|
---|
10 |
|
---|
11 | if [[ "${DEP_LIBXML}" = "y" ]] ; then
|
---|
12 | echo "${LIBXML_URL} ${BLFS_SERVER}libxml2/${LIBXML_PKG} ${LIBXML_MD5}" >> urls.lst
|
---|
13 | fi
|
---|
14 |
|
---|
15 | if [[ "${DEP_LIBXSLT}" = "y" ]] ; then
|
---|
16 | echo "${LIBXSLT_URL} ${BLFS_SERVER}libxslt/${LIBXSLT_PKG} ${LIBXSLT_MD5}" >> urls.lst
|
---|
17 | fi
|
---|
18 |
|
---|
19 | if [[ "${DEP_TIDY}" = "y" ]] ; then
|
---|
20 | echo "${TIDY_URL} ${BLFS_SERVER}tidy/${TIDY_PKG} ${TIDY_MD5}" >> urls.lst
|
---|
21 | fi
|
---|
22 |
|
---|
23 | if [[ "${DEP_UNZIP}" = "y" ]] ; then
|
---|
24 | echo "${UNZIP_URL} ${BLFS_SERVER}unzip/${UNZIP_PKG} ${UNZIP_MD5}" >> urls.lst
|
---|
25 | fi
|
---|
26 |
|
---|
27 | if [[ "${DEP_DBXML}" = "y" ]] ; then
|
---|
28 | echo "${DBXML_URL} ${BLFS_SERVER}docbook-xml/${DBXML_PKG} ${DBXML_MD5}" >> urls.lst
|
---|
29 | fi
|
---|
30 |
|
---|
31 | # if [[ "${DEP_DBXSL}" = "y" ]] ; then
|
---|
32 | # echo "${DBXSL_URL} ${BLFS_SERVER}docbook-xsl/${DBXSL_PKG} ${DBXSL_MD5}" >> urls.lst
|
---|
33 | # fi
|
---|
34 |
|
---|
35 | if [[ "${DEP_LYNX}" = "y" ]] ; then
|
---|
36 | echo "${LYNX_URL} ${BLFS_SERVER}lynx/${LYNX_PKG} ${LYNX_MD5}" >> urls.lst
|
---|
37 | fi
|
---|
38 |
|
---|
39 | if [[ "${DEP_SUDO}" = "y" ]] ; then
|
---|
40 | echo "${SUDO_URL} ${BLFS_SERVER}sudo/${SUDO_PKG} ${SUDO_MD5}" >> urls.lst
|
---|
41 | fi
|
---|
42 |
|
---|
43 | if [[ "${DEP_WGET}" = "y" ]] ; then
|
---|
44 | echo "${WGET_URL} ${BLFS_SERVER}wget/${WGET_PKG} ${WGET_MD5}" >> urls.lst
|
---|
45 | fi
|
---|
46 |
|
---|
47 | if [[ "${DEP_SVN}" = "y" ]] ; then
|
---|
48 | echo "${SQLITE_URL} ${BLFS_SERVER}sqlite/${SQLITE_PKG} ${SQLITE_MD5}" >> urls.lst
|
---|
49 | echo "${APR_URL} ${BLFS_SERVER}apr/${APR_PKG} ${APR_MD5}" >> urls.lst
|
---|
50 | ## Cannot use file:// with wget, so cannot download apr patches.
|
---|
51 | ## They have been put directly in $BUILDDIR/sources
|
---|
52 | ## The next line only for being able to check md5sum
|
---|
53 | echo "${APR_PATCH_1_URL} ${BLFS_SERVER}apr/${APR_PATCH_1} ${APR_PATCH_1_MD5}" >> urls.lst
|
---|
54 |
|
---|
55 | echo "${APR_U_URL} ${BLFS_SERVER}apr-util/${APR_U_PKG} ${APR_U_MD5}" >> urls.lst
|
---|
56 | echo "${APR_U_PATCH_1_URL} ${BLFS_SERVER}apr-util/${APR_U_PATCH_1} ${APR_U_PATCH_1_MD5}" >> urls.lst
|
---|
57 | echo "${SVN_URL} ${BLFS_SERVER}subversion/${SVN_PKG} ${SVN_MD5}" >> urls.lst
|
---|
58 | fi
|
---|
59 |
|
---|
60 | if [[ "${DEP_GPM}" = "y" ]] ; then
|
---|
61 | echo "${GPM_URL} ${BLFS_SERVER}gpm/${GPM_PKG} ${GPM_MD5}" >> urls.lst
|
---|
62 | fi
|
---|
63 |
|
---|
64 | }
|
---|
65 |
|
---|
66 | #----------------------------# Maybe there is a better way to do this, but this
|
---|
67 | copy_blfs_deps_scripts() { # method avoid to place the test on all
|
---|
68 | #----------------------------# $PROGNAME/master.sh scripts.
|
---|
69 |
|
---|
70 | mkdir -p ${PROGNAME}-commands/blfs-tool-deps
|
---|
71 |
|
---|
72 | if [[ "${DEP_LIBXML}" = "y" ]] ; then
|
---|
73 | mv blfs-tool-deps/901-libxml2 ${PROGNAME}-commands/blfs-tool-deps
|
---|
74 | fi
|
---|
75 |
|
---|
76 | if [[ "${DEP_LIBXSLT}" = "y" ]] ; then
|
---|
77 | mv blfs-tool-deps/902-libxslt ${PROGNAME}-commands/blfs-tool-deps
|
---|
78 | fi
|
---|
79 |
|
---|
80 | if [[ "${DEP_TIDY}" = "y" ]] ; then
|
---|
81 | mv blfs-tool-deps/903-tidy ${PROGNAME}-commands/blfs-tool-deps
|
---|
82 | fi
|
---|
83 |
|
---|
84 | if [[ "${DEP_UNZIP}" = "y" ]] ; then
|
---|
85 | mv blfs-tool-deps/904-unzip ${PROGNAME}-commands/blfs-tool-deps
|
---|
86 | fi
|
---|
87 |
|
---|
88 | if [[ "${DEP_DBXML}" = "y" ]] ; then
|
---|
89 | mv blfs-tool-deps/905-docbook-xml ${PROGNAME}-commands/blfs-tool-deps
|
---|
90 | fi
|
---|
91 |
|
---|
92 | # if [[ "${DEP_DBXSL}" = "y" ]] ; then
|
---|
93 | # mv blfs-tool-deps/906-docbook-xsl ${PROGNAME}-commands/blfs-tool-deps
|
---|
94 | # fi
|
---|
95 |
|
---|
96 | if [[ "${DEP_LYNX}" = "y" ]] ; then
|
---|
97 | mv blfs-tool-deps/908-lynx ${PROGNAME}-commands/blfs-tool-deps
|
---|
98 | fi
|
---|
99 |
|
---|
100 | if [[ "${DEP_SUDO}" = "y" ]] ; then
|
---|
101 | mv blfs-tool-deps/909-sudo ${PROGNAME}-commands/blfs-tool-deps
|
---|
102 | fi
|
---|
103 |
|
---|
104 | if [[ "${DEP_WGET}" = "y" ]] ; then
|
---|
105 | mv blfs-tool-deps/910-wget ${PROGNAME}-commands/blfs-tool-deps
|
---|
106 | fi
|
---|
107 |
|
---|
108 | if [[ "${DEP_SVN}" = "y" ]] ; then
|
---|
109 | mv blfs-tool-deps/911-sqlite ${PROGNAME}-commands/blfs-tool-deps
|
---|
110 | mv blfs-tool-deps/912-apr ${PROGNAME}-commands/blfs-tool-deps
|
---|
111 | mv blfs-tool-deps/913-apr-util ${PROGNAME}-commands/blfs-tool-deps
|
---|
112 | mv blfs-tool-deps/914-subversion ${PROGNAME}-commands/blfs-tool-deps
|
---|
113 | fi
|
---|
114 |
|
---|
115 | if [[ "${DEP_GPM}" = "y" ]] ; then
|
---|
116 | mv blfs-tool-deps/907-gpm ${PROGNAME}-commands/blfs-tool-deps
|
---|
117 | fi
|
---|
118 |
|
---|
119 | rm -rf blfs-tool-deps
|
---|
120 |
|
---|
121 | }
|
---|
122 |
|
---|
123 |
|
---|
124 | #----------------------------------#
|
---|
125 | wrt_blfs_tool_targets() { #
|
---|
126 | #----------------------------------#
|
---|
127 | PREV=""
|
---|
128 |
|
---|
129 | echo "${tab_}${GREEN}Processing... ${L_arrow}BLFS_TOOL ${R_arrow}"
|
---|
130 |
|
---|
131 | for file in blfs-tool-deps/* ; do
|
---|
132 | # Keep the script file name
|
---|
133 | this_script=`basename $file`
|
---|
134 |
|
---|
135 | # Grab the name of the target
|
---|
136 | name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@'`
|
---|
137 |
|
---|
138 | # Find the package.
|
---|
139 | case $name in
|
---|
140 | lynx ) pkg_tarball=${LYNX_PKG} ;;
|
---|
141 | tidy ) pkg_tarball=${TIDY_PKG} ;;
|
---|
142 | unzip ) pkg_tarball=${UNZIP_PKG} ;;
|
---|
143 | * ) pkg_tarball=$(get_package_tarball_name $name) ;;
|
---|
144 | esac
|
---|
145 |
|
---|
146 | # Append each name of the script files to a list (this will become
|
---|
147 | # the names of the targets in the Makefile)
|
---|
148 | blfs_tool="$blfs_tool ${this_script}"
|
---|
149 |
|
---|
150 | #--------------------------------------------------------------------#
|
---|
151 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
152 | #--------------------------------------------------------------------#
|
---|
153 | #
|
---|
154 | # Drop in the name of the target on a new line, and the previous target
|
---|
155 | # as a dependency. Also call the echo_message function.
|
---|
156 | if [ "$PROGNAME" = "clfs2" ]; then
|
---|
157 | LUSER_wrt_target "${this_script}" "$PREV"
|
---|
158 | else
|
---|
159 | CHROOT_wrt_target "${this_script}" "$PREV"
|
---|
160 | fi
|
---|
161 |
|
---|
162 | # Insert instructions for unpacking the package and changing directories
|
---|
163 | # DocBook-XML is a zip, the build script will handle that.
|
---|
164 | if [ "$PROGNAME" = "clfs2" ]; then
|
---|
165 | [[ ! "$name" = "docbook-xml" ]] && LUSER_wrt_unpack "$pkg_tarball"
|
---|
166 | else
|
---|
167 | case "$name" in
|
---|
168 | *docbook*)
|
---|
169 | (
|
---|
170 | cat << EOF
|
---|
171 | @if [ "\$(PKGMNGT)" = "y" ]; then \\
|
---|
172 | echo "export PKG_DEST=\$(SRC)/\$@" > envars; \\
|
---|
173 | echo "source packInstall.sh" >> envars; \\
|
---|
174 | echo "export -f packInstall" >> envars; \\
|
---|
175 | fi;
|
---|
176 | EOF
|
---|
177 | ) >> $MKFILE.tmp ;;
|
---|
178 | *) CHROOT_Unpack "$pkg_tarball" ;;
|
---|
179 | esac
|
---|
180 | fi
|
---|
181 |
|
---|
182 | # Run the script.
|
---|
183 | if [ "$PROGNAME" = "clfs2" ]; then
|
---|
184 | LUSER_wrt_RunAsUser "${file}"
|
---|
185 | else
|
---|
186 | CHROOT_wrt_RunAsRoot "$file"
|
---|
187 | fi
|
---|
188 |
|
---|
189 | # Remove the build directory(ies) except if the package build fails.
|
---|
190 | if [ "$PROGNAME" = "clfs2" ]; then
|
---|
191 | [[ ! "$name" = "docbook-xml" ]] && LUSER_RemoveBuildDirs "$name"
|
---|
192 | else
|
---|
193 | [[ ! "$name" = "docbook-xml" ]] && CHROOT_wrt_RemoveBuildDirs "$name"
|
---|
194 | fi
|
---|
195 |
|
---|
196 | # Touch the tracking file.
|
---|
197 | case $name in
|
---|
198 | docbook-xml ) pkg_ver=DocBook-4.5 ;;
|
---|
199 | lynx ) pkg_ver=lynx-2.8.7 ;;
|
---|
200 | tidy ) pkg_ver=html-tidy-cvs_20101110 ;;
|
---|
201 | unzip ) pkg_ver=unzip-6.0 ;;
|
---|
202 | * ) pkg_ver=$(echo $pkg_tarball | sed -e 's/.tar.*//;s/.tgz//;s/.zip//') ;;
|
---|
203 | esac
|
---|
204 | if [ "$PROGNAME" = "clfs2" ]; then
|
---|
205 | echo -e "\t@touch \$(MOUNT_PT)$TRACKING_DIR/$pkg_ver" >> $MKFILE.tmp
|
---|
206 | else
|
---|
207 | echo -e "\t@touch $TRACKING_DIR/$pkg_ver" >> $MKFILE.tmp
|
---|
208 | fi
|
---|
209 |
|
---|
210 | # Include a touch of the target name so make can check
|
---|
211 | # if it's already been made.
|
---|
212 | wrt_touch
|
---|
213 | #
|
---|
214 | #--------------------------------------------------------------------#
|
---|
215 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
216 | #--------------------------------------------------------------------#
|
---|
217 |
|
---|
218 | # Keep the script file name for Makefile dependencies.
|
---|
219 | PREV=${this_script}
|
---|
220 | done
|
---|
221 | }
|
---|