source: BLFS/gen_config.sh@ fd3dcd4

experimental
Last change on this file since fd3dcd4 was fd3dcd4, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Fix ALSA packages version.

  • Property mode set to 100755
File size: 5.7 KB
Line 
1#!/bin/bash
2#
3# $Id:$
4#
5
6export outFile=aConfig.in # file for reading and writing to.
7export inFile=packages # file for reading and writing to.
8
9declare TRACKING_DIR=/var/lib/jhalfs/BLFS
10
11declare PKG_NAME
12declare PKG_XML_FILE
13declare PKG_DIR
14declare SAVE_IFS=${IFS}
15declare -a DIR_TREE
16declare PREV_DIR1="none"
17declare PREV_DIR2="none"
18declare MENU_SET1="n"
19declare MENU_SET2="n"
20
21declare PKG_VER
22
23get_pkg_ver() {
24 local this_script=$1
25
26 [[ ${this_script:0:4} = "alsa" ]] && this_script=alsa
27
28 PKG_VER=$(xmllint --noent ./blfs-xml/book/bookinfo.xml 2>/dev/null | \
29 grep -i " ${this_script}-version " | cut -d "\"" -f2 )
30
31}
32
33> $outFile
34
35#---------------------#
36# MAIN #
37#---------------------#
38: <<enddoc
39 This script will create a Config.in file from the contents
40 of the file <packages>.
41 Packages previously installed will not be included.
42enddoc
43
44echo -en "\tGenerating Config.in from package data ..."
45while [ 0 ]
46do
47
48# read -r || break 1
49 read || break 1
50 if [[ "${REPLY}" = "" ]] || \
51 [[ "${REPLY:0:1}" = "=" ]] || \
52 [[ "${REPLY:0:1}" = "#" ]]; then
53 continue
54 fi
55
56 set -- $REPLY
57 PKG_NAME=$1
58 PKG_XML_FILE=$(basename $2)
59 PKG_DIR=$(dirname $2)
60 # These are the META packages. for gnome and kde (soon ALSA and Xorg7)
61 if [ $PKG_DIR = "." ]; then
62 SET_COMMENT=y
63 # Do not include previously installed packages....
64 if [ -e $TRACKING_DIR/${PKG_NAME} ]; then continue; fi
65
66 META_PKG=$(echo ${PKG_NAME} | tr [a-z] [A-Z])
67 echo -e "config CONFIG_$META_PKG" >> $outFile
68 echo -e "\tbool \"$META_PKG\"" >> $outFile
69 echo -e "\tdefault n" >> $outFile
70
71 echo -e "menu \"$(echo ${PKG_NAME} | tr [a-z] [A-Z]) components\"" >> $outFile
72 echo -e "\tdepends\tCONFIG_$META_PKG" >> $outFile
73 # Include the dependency data for this meta package
74 while [ 0 ]; do
75 read || break 1
76 PKG_NAME=${REPLY}
77 get_pkg_ver "${PKG_NAME}"
78(
79cat << EOF
80 config DEP_${META_PKG}_${PKG_NAME}
81 bool "$PKG_NAME ${PKG_VER}"
82 default y
83
84EOF
85) >> $outFile
86 done <./libs/${PKG_NAME}.dep
87 echo -e "endmenu" >> $outFile
88 continue
89 fi
90 [[ "${SET_COMMENT}" = "y" ]] && echo "comment \"\"" >>$outFile; unset SET_COMMENT
91
92 # Deal with a few unusable chapter names
93 case ${PKG_NAME} in
94 other-* | others-* ) continue
95 ;;
96 xorg7-* ) # Deal with sub-elements of Xorg7, mandatory for build.
97 # No need to (even possible?) to build separately
98 continue
99 ;;
100 alsa-* ) continue ;;
101 esac
102
103 # IF this package name-version exists in the tracking dir
104 # do not add this package to the list of installable pkgs.
105 get_pkg_ver "${PKG_NAME}"
106 if [ -e $TRACKING_DIR/${PKG_NAME}-${PKG_VER} ]; then continue; fi
107
108 IFS="/"
109 DIR_TREE=(${PKG_DIR})
110 IFS="$SAVE_IFS"
111
112 # Define a top level menu
113 if [ "$PREV_DIR1" != "${DIR_TREE[1]}" ]; then
114 [[ "${DIR_TREE[1]}" = "kde" ]] && continue
115 [[ "${DIR_TREE[1]}" = "gnome" ]] && continue
116
117 if [ $MENU_SET1 = "y" ]; then
118 # Close out any open secondary menu
119 if [ $MENU_SET2 = "y" ]; then
120 echo -e "\tendmenu" >> $outFile
121 # Reset 'menu open' flag
122 MENU_SET2="n"
123 fi
124 # Close the current top level menu
125 echo -e "endmenu\n" >> $outFile
126 fi
127 # Open a new top level menu
128 echo -e "menu "$(echo ${DIR_TREE[1]:0:1} | tr [a-z] [A-Z])${DIR_TREE[1]:1}"" >> $outFile
129 MENU_SET1="y"
130 fi
131
132 # Define a secondary menu
133 if [ "$PREV_DIR2" != "${DIR_TREE[2]}" ]; then
134 # Close out the previous open menu structure
135 if [ $MENU_SET2 = "y" ]; then
136 echo -e "\tendmenu\n" >> $outFile
137 fi
138 # Initialize a new 2nd level menu structure.
139 echo -e "\tmenu "$(echo ${DIR_TREE[2]:0:1} | tr [a-z] [A-Z])${DIR_TREE[2]:1}"" >> $outFile
140 MENU_SET2="y"
141 fi
142(
143cat << EOF
144 config CONFIG_$PKG_NAME
145 bool "$PKG_NAME ${PKG_VER}"
146 default n
147EOF
148) >> $outFile
149
150 PREV_DIR1=${DIR_TREE[1]}
151 PREV_DIR2=${DIR_TREE[2]}
152done <"$inFile"
153
154if [ $MENU_SET2 = "y" ]; then echo -e "\tendmenu" >> $outFile; fi
155if [ $MENU_SET1 = "y" ]; then echo "endmenu" >> $outFile; fi
156
157(
158cat << EOF
159
160comment ""
161
162menu "Default packages for resolving dependencies"
163
164choice
165 prompt "Default print server"
166 config PS_cups
167 bool "cups"
168 config PS_LPRng
169 bool "LPRng"
170endchoice
171config PRINT_SERVER
172 string
173 default cups if PS_cups
174 default LPRng if PS_LPRng
175
176choice
177 prompt "Mail server"
178 config MS_sendmail
179 bool "sendmail"
180 config MS_postfix
181 bool "postfix"
182 config MS_exim
183 bool "exim"
184endchoice
185config MAIL_SERVER
186 string
187 default sendmail if MS_sendmail
188 default postfix if MS_postfix
189 default exim if MS_exim
190
191choice
192 prompt "Postscript package"
193 config GS_espgs
194 bool "espgs"
195 config GS_ghostscript
196 bool "ghostscript"
197endchoice
198config GHOSTSCRIPT
199 string
200 default espgs if GS_espgs
201 default ghostscript if GS_ghostscript
202
203choice
204 prompt "Kerberos 5"
205 config KER_mitkrb
206 bool "mitkrb"
207 config KER_heimdal
208 bool "heimdal"
209endchoice
210config KBR5
211 string
212 default heimdal if KER_heimdal
213 default mitkrb if KER_mitkrb
214
215choice
216 prompt "Window package"
217 config WIN_xorg7
218 bool "Xorg7"
219 config WIN_xorg
220 bool "Xorg"
221 config WIN_xfree86
222 bool "xfree86"
223endchoice
224config X11
225 string
226 default xorg7 if WIN_xorg7
227 default xorg if WIN_xorg
228 default xfree86 if WIN_xfree86
229endmenu
230
231choice
232 prompt "Dependency level"
233 default DEPLVL_2
234
235 config DEPLVL_1
236 bool "Required dependencies only"
237
238 config DEPLVL_2
239 bool "Required and recommended dependencies"
240
241 config DEPLVL_3
242 bool "Required, recommended and optional dependencies"
243
244endchoice
245config optDependency
246 int
247 default 1 if DEPLVL_1
248 default 2 if DEPLVL_2
249 default 3 if DEPLVL_3
250
251
252config SUDO
253 bool "Build as User"
254 default y
255 help
256 Select if sudo will be used (you want build as a normal user)
257 otherwise sudo is not needed (you want build as root)
258
259EOF
260) >> $outFile
261echo "done"
262
263
Note: See TracBrowser for help on using the repository browser.