source: BLFS/gen_config.sh@ 7b66bcf

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

Fix KDE packages version.

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