source: BLFS/gen_config.sh@ 339fd84

2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 339fd84 was 155e2b4, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Fixing keywords property.

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