]> pilppa.org Git - familiar-h63xx-build.git/blob - setup/build-env.sh
gnutls: bump PR. don't use _prepend for do_configure.
[familiar-h63xx-build.git] / setup / build-env.sh
1 #!/bin/sh
2
3 # Familiar Build Setup Script
4 #
5 # Copyright (C) 2006  Rene Wagner <rw@handhelds.org>
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20 #
21
22 BASE_TITLE="Familiar Build Setup:"
23 FAMILIAR_RELEASE="0.8.4"
24
25 fatal() {
26         echo "Fatal: $1"
27         exit 1
28 }
29
30 error() {
31         zenity --error --text="$1"
32 }
33
34 abort() {
35         zenity --info --text="Setup aborted."
36         exit 1
37 }
38
39 which zenity > /dev/null || fatal "You must have zenity installed."
40
41 BASE_DIR=${PWD}
42 while [ ! -d ${BASE_DIR}/org.handhelds.familiar ]; do
43          BASE_DIR=`zenity --file-selection --directory --filename=${BASE_DIR} --title="${BASE_TITLE} Select Build Tree Base Directory"`
44          case $? in
45                 0)
46                         if [ ! -d ${BASE_DIR}/org.handhelds.familiar ]; then
47                                 error "Does not look like a Familiar build tree: ${BASE_DIR}"
48                         fi
49                         ;;
50                 1)
51                         abort;;
52                 -1)
53                         abort;;
54         esac
55 done
56
57 DL_DIR="${BASE_DIR}/downloads"
58 DL_DIR=`zenity  --entry \
59         --title="${BASE_TITLE} Downloads Directory" \
60         --text="Where do you want downloaded files to be stored?" \
61         --entry-text="${DL_DIR}"`
62 case $? in
63         1)
64                 abort;;
65         -1)
66                 abort;;
67 esac
68
69 while [ -z "$MACHINE" ]; do
70 MACHINE=`zenity  --list \
71         --height=280 \
72         --title="${BASE_TITLE} Target Machine" \
73         --text="Select a target machine type from the list below:" \
74         --column="Name" --column="Description" \
75         "h3600" "HP iPAQ h36xx/h37xx/h38xx Series" \
76         "h3900" "HP iPAQ h39xx/h51xx/h54xx/h55xx Series" \
77         "h2200" "HP iPAQ h22xx Series" \
78         "ipaq-pxa270" "HP iPAQ hx4700 Series" \
79         "h6300" "HP iPAQ h63xx Series"`
80 case $? in
81         0)
82                 if [ -z "$MACHINE" ]; then
83                         error "Please select a target machine."
84                 fi
85                 ;;
86         1)
87                 abort;;
88         -1)
89                 abort;;
90 esac
91 done
92
93 while [ -z "$GRAPHICAL_ENV" ]; do
94 GRAPHICAL_ENV=`zenity  --list \
95         --height=280 \
96         --title="${BASE_TITLE} Primary Graphical Environment" \
97         --text="Select the graphical environment you want to build for from the list below:" \
98         --column="Name" --column="Description" \
99         "gpe" "The GPE Palmtop Environment. X11 based." \
100         "opie" "The Open Palmtop Integrated Environment. Qt/Embedded based." \
101         "any" "No preference. This may break certain things."`
102 case $? in
103         0)
104                 if [ -z "$GRAPHICAL_ENV" ]; then
105                         error "Please select a graphical environment."
106                 fi
107                 ;;
108         1)
109                 abort;;
110         -1)
111                 abort;;
112 esac
113 done
114
115 BUILD_DIR="${BASE_DIR}/build-${MACHINE}-${GRAPHICAL_ENV}"
116 while true; do
117         BUILD_DIR=`zenity  --entry \
118                 --title="${BASE_TITLE} Build Directory" \
119                 --text="A build directory will be created for the configuration you selected at the following location:" \
120                 --entry-text="${BUILD_DIR}"`
121         case $? in
122                 1)
123                         abort;;
124                 -1)
125                         abort;;
126         esac
127         if [ -z ${BUILD_DIR} ]; then
128                 error "Please specify a build directory."
129                 continue
130         fi
131         if [ -d ${BUILD_DIR} ]; then
132                 error "${BUILD_DIR} exists."
133                 continue
134         fi
135         
136         break
137 done
138
139 mkdir -p ${BUILD_DIR}/conf
140 CONFFILE="${BUILD_DIR}/conf/auto.conf"
141 cat >  ${CONFFILE} <<EOF
142 # Auto-generated Familiar Build Configuration
143
144 DISTRO="familiar-${FAMILIAR_RELEASE}"
145
146 # where to store downloaded files
147 DL_DIR = "${DL_DIR}"
148
149 # list of .bb files as a shell glob
150 BBFILES = "${BASE_DIR}/org.handhelds.familiar/packages/*/*bb"
151
152 # top level build directory for this configuration
153 TOPDIR = "${BUILD_DIR}"
154
155 # target MACHINE
156 MACHINE = "${MACHINE}"
157
158 EOF
159
160 if [ "${GRAPHICAL_ENV}" == "gpe" ]; then
161 cat >> ${CONFFILE} <<EOF
162 # X11 specific settings
163 PREFERRED_PROVIDERS += " virtual/libsdl:libsdl-x11"
164
165 EOF
166 elif [ "${GRAPHICAL_ENV}" == "opie" ]; then
167 cat >> ${CONFFILE} <<EOF
168 # Opie specific settings
169 PREFERRED_PROVIDERS += " virtual/libsdl:libsdl-qpe"
170
171 EOF
172 fi
173
174 ENVSCRIPT="${BUILD_DIR}/conf/env.sh"
175 cat > ${ENVSCRIPT} <<EOF
176 PATH="${BASE_DIR}/bitbake/bin:${PATH}"
177 BBPATH="${BUILD_DIR}:${BASE_DIR}/org.handhelds.familiar"
178
179 export PATH BBPATH
180 EOF
181
182 zenity  --info \
183         --title="${BASE_TITLE} Setup Complete" \
184         --text="Your configuration was written to ${CONFFILE}. It will be displayed after this dialog. Please verify that all settings are correct. To re-start the setup please delete the build directory and re-run the setup tool."
185
186 zenity  --text-info \
187         --width=600 --height=400 \
188         --title="${BASE_TITLE} Configuration Written to ${CONFFILE}" \
189         --filename="${CONFFILE}"
190
191 zenity  --info \
192         --title="${BASE_TITLE} Running a Build" \
193         --text="Please run the following command before attempting to run a build: \"$ source ${ENVSCRIPT}\". It will configure the environment so you can run bitbake."