author | kergoth <kergoth> | 2003-01-26 19:46:41 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-01-26 19:46:41 (UTC) |
commit | f389dd4e3d5ceacb15b5c0b751a618d7586d6c31 (patch) (unidiff) | |
tree | 4409bbfaee1f3467ccebef0d1ebbd20ba949bad0 /mkipks | |
parent | fcc5341e8eaef9586cb7fd2b40a22198de0d196d (diff) | |
download | opie-f389dd4e3d5ceacb15b5c0b751a618d7586d6c31.zip opie-f389dd4e3d5ceacb15b5c0b751a618d7586d6c31.tar.gz opie-f389dd4e3d5ceacb15b5c0b751a618d7586d6c31.tar.bz2 |
Rather hackish, but necessary, bits. mkipks now parses the qglobal header from $QTDIR to obtain both the base qt version and the full version string, thereby letting me use ipkg depends to Depends: libqt2-emb (>= 2.3.4-beta4).
-rwxr-xr-x | mkipks | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -1,242 +1,258 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | [ -z "$QTE_VERSION" ] && QTE_VERSION=2.3.4 | 3 | if [ -z "$QTE_BASEVERSION" ] |
4 | [ -z "$QTE_BASEVERSION" ] && QTE_BASEVERSION=2.3.4 | 4 | then |
5 | if [ -e $QTDIR/include/qglobal.h ] | ||
6 | then | ||
7 | QTE_BASEVERSION=`cat $QTDIR/include/qglobal.h|grep '^#define QT_VERSION'|grep -v STR|sed -e 's,#define QT_VERSION\t*,,;' -e 's,.*\([0-9]\)\([0-9]\)\([0-9]\).*,\1.\2.\3,;'` | ||
8 | else | ||
9 | QTE_BASEVERSION=2.3.4 | ||
10 | fi | ||
11 | fi | ||
12 | if [ -z "$QTE_VERSION" ] | ||
13 | then | ||
14 | if [ -e $QTDIR/include/qglobal.h ] | ||
15 | then | ||
16 | QTE_VERSION=`cat $QTDIR/include/qglobal.h|grep '^#define QT_VERSION_STR'|sed -e 's,#define QT_VERSION_STR\t*,,;' -e 's,.*"\([^"]*\)".*,\1,;'` | ||
17 | else | ||
18 | QTE_VERSION=2.3.4 | ||
19 | fi | ||
20 | fi | ||
5 | [ -z "$QTE_REVISION" ] && QTE_REVISION=3 | 21 | [ -z "$QTE_REVISION" ] && QTE_REVISION=3 |
6 | DEB_VERSION=2.0 | 22 | DEB_VERSION=2.0 |
7 | 23 | ||
8 | # Have to do this here, since CVS can't store symlinks | 24 | # Have to do this here, since CVS can't store symlinks |
9 | 25 | ||
10 | mkdir -p $OPIEDIR/etc/rcS.d | 26 | mkdir -p $OPIEDIR/etc/rcS.d |
11 | ln -sf ../init.d/bootsplash $OPIEDIR/etc/rcS.d/S01bootsplash | 27 | ln -sf ../init.d/bootsplash $OPIEDIR/etc/rcS.d/S01bootsplash |
12 | 28 | ||
13 | VERSION_MAJ=$(sed -n -e 's/.*QPE_VERSION "\([0-9]*\)\..*\..*".*/\1/p' <$OPIEDIR/include/qpe/version.h) | 29 | VERSION_MAJ=$(sed -n -e 's/.*QPE_VERSION "\([0-9]*\)\..*\..*".*/\1/p' <$OPIEDIR/include/qpe/version.h) |
14 | VERSION_MIN=$(sed -n -e 's/.*QPE_VERSION ".*\.\([0-9]*\)\..*".*/\1/p' <$OPIEDIR/include/qpe/version.h) | 30 | VERSION_MIN=$(sed -n -e 's/.*QPE_VERSION ".*\.\([0-9]*\)\..*".*/\1/p' <$OPIEDIR/include/qpe/version.h) |
15 | VERSION_PAT=$(sed -n -e 's/.*QPE_VERSION ".*\..*\.\([0-9]*\).*/\1/p' <$OPIEDIR/include/qpe/version.h) | 31 | VERSION_PAT=$(sed -n -e 's/.*QPE_VERSION ".*\..*\.\([0-9]*\).*/\1/p' <$OPIEDIR/include/qpe/version.h) |
16 | SUB_VERSION=$(sed -n -e 's,.*SUB_VERSION \"\(.*\)\".*,\1,p' <$OPIEDIR/include/qpe/version.h) | 32 | SUB_VERSION=$(sed -n -e 's,.*SUB_VERSION \"\(.*\)\".*,\1,p' <$OPIEDIR/include/qpe/version.h) |
17 | if grep -q 'QPE_VERSION .*snapshot' $OPIEDIR/include/qpe/version.h | 33 | if grep -q 'QPE_VERSION .*snapshot' $OPIEDIR/include/qpe/version.h |
18 | then | 34 | then |
19 | [ -z "$VERSION_CVS" ] && VERSION_CVS="$(date +%Y%m%d)" | 35 | [ -z "$VERSION_CVS" ] && VERSION_CVS="$(date +%Y%m%d)" |
20 | SUB_VERSION=$VERSION_CVS | 36 | SUB_VERSION=$VERSION_CVS |
21 | else | 37 | else |
22 | VERSION_CVS="" | 38 | VERSION_CVS="" |
23 | fi | 39 | fi |
24 | 40 | ||
25 | QPE_VERSION=$VERSION_MAJ.$VERSION_MIN.$VERSION_PAT | 41 | QPE_VERSION=$VERSION_MAJ.$VERSION_MIN.$VERSION_PAT |
26 | 42 | ||
27 | ARCH=arm | 43 | ARCH=arm |
28 | STRIP=arm-linux-strip | 44 | STRIP=arm-linux-strip |
29 | STRIP_FILES="*ARM*not stripped" | 45 | STRIP_FILES="*ARM*not stripped" |
30 | 46 | ||
31 | TDIR=/tmp/ipk$$ | 47 | TDIR=/tmp/ipk$$ |
32 | DATADIR=$TDIR | 48 | DATADIR=$TDIR |
33 | CTRLDIR=$TDIR/CONTROL | 49 | CTRLDIR=$TDIR/CONTROL |
34 | 50 | ||
35 | IMAGEDIR= | 51 | IMAGEDIR= |
36 | VERB= | 52 | VERB= |
37 | LIST= | 53 | LIST= |
38 | RPM= | 54 | RPM= |
39 | 55 | ||
40 | while [ $# -ne 0 ] | 56 | while [ $# -ne 0 ] |
41 | do | 57 | do |
42 | case "$1" in | 58 | case "$1" in |
43 | -v) | 59 | -v) |
44 | VERB=1 | 60 | VERB=1 |
45 | echo >&2 "Packaging for version $VERSION_MAJ.$VERSION_MIN.$VERSION_PAT$VERSION_CVS" | 61 | echo >&2 "Packaging for version $VERSION_MAJ.$VERSION_MIN.$VERSION_PAT$VERSION_CVS" |
46 | ;; -l) | 62 | ;; -l) |
47 | LIST=1 | 63 | LIST=1 |
48 | ;; -i) | 64 | ;; -i) |
49 | shift | 65 | shift |
50 | IMAGEDIR=$1 | 66 | IMAGEDIR=$1 |
51 | DATADIR=$IMAGEDIR | 67 | DATADIR=$IMAGEDIR |
52 | mkdir -p $IMAGEDIR | 68 | mkdir -p $IMAGEDIR |
53 | ;; -classic) | 69 | ;; -classic) |
54 | classicopts=-c | 70 | classicopts=-c |
55 | ;; -rpm) | 71 | ;; -rpm) |
56 | if [ "$OPIEDIR" != "/opt/Qtopia" ] | 72 | if [ "$OPIEDIR" != "/opt/Qtopia" ] |
57 | then | 73 | then |
58 | echo >&2 '$OPIEDIR is not the standard /usr/Qtopia directory.' | 74 | echo >&2 '$OPIEDIR is not the standard /usr/Qtopia directory.' |
59 | sleep 1 | 75 | sleep 1 |
60 | #exit 1 | 76 | #exit 1 |
61 | fi | 77 | fi |
62 | RPM=1 | 78 | RPM=1 |
63 | ;; -arch) | 79 | ;; -arch) |
64 | shift | 80 | shift |
65 | ARCH=$1 | 81 | ARCH=$1 |
66 | STRIP= | 82 | STRIP= |
67 | STRIP_FILES= | 83 | STRIP_FILES= |
68 | ;; /*) | 84 | ;; /*) |
69 | FILES="$FILES $1" | 85 | FILES="$FILES $1" |
70 | ;; *) | 86 | ;; *) |
71 | FILES="$FILES $PWD/$1" | 87 | FILES="$FILES $PWD/$1" |
72 | esac | 88 | esac |
73 | shift | 89 | shift |
74 | done | 90 | done |
75 | 91 | ||
76 | if [ -z "$FILES" ] | 92 | if [ -z "$FILES" ] |
77 | then | 93 | then |
78 | FILES=`find $OPIEDIR -name "*.control" -print` | 94 | FILES=`find $OPIEDIR -name "*.control" -print` |
79 | fi | 95 | fi |
80 | 96 | ||
81 | RDIR=$PWD | 97 | RDIR=$PWD |
82 | ORIGDIR=`pwd` | 98 | ORIGDIR=`pwd` |
83 | cd $OPIEDIR | 99 | cd $OPIEDIR |
84 | 100 | ||
85 | for i in $FILES | 101 | for i in $FILES |
86 | do | 102 | do |
87 | rm -rf $TDIR | 103 | rm -rf $TDIR |
88 | 104 | ||
89 | mkdir -p $DATADIR | 105 | mkdir -p $DATADIR |
90 | mkdir -p $CTRLDIR | 106 | mkdir -p $CTRLDIR |
91 | 107 | ||
92 | packagename=${i##*/}; packagename=${packagename%.control} | 108 | packagename=${i##*/}; packagename=${packagename%.control} |
93 | version=$(eval echo '"'$(sed -n -e "s/^Version: *//p" $i)'"') | 109 | version=$(eval echo '"'$(sed -n -e "s/^Version: *//p" $i)'"') |
94 | depends=$(eval echo '"'$(sed -n -e "s/^Depends: *//p" $i)'"') | 110 | depends=$(eval echo '"'$(sed -n -e "s/^Depends: *//p" $i)'"') |
95 | files=$(eval echo $(sed -n -e "s/^Files://p" $i)) | 111 | files=$(eval echo $(sed -n -e "s/^Files://p" $i)) |
96 | arch=$(eval echo $(sed -n -e "s/^Arch://p" $i)) | 112 | arch=$(eval echo $(sed -n -e "s/^Arch://p" $i)) |
97 | section=$(sed -n -e "s/^Section: *//p" $i) | 113 | section=$(sed -n -e "s/^Section: *//p" $i) |
98 | provides=$(sed -n -e "s/^Provides: *//p" $i) | 114 | provides=$(sed -n -e "s/^Provides: *//p" $i) |
99 | conflicts=$(sed -n -e "s/^Conflicts: *//p" $i) | 115 | conflicts=$(sed -n -e "s/^Conflicts: *//p" $i) |
100 | license=$(sed -n -e "s/^License: *//p" $i) | 116 | license=$(sed -n -e "s/^License: *//p" $i) |
101 | summary=$(sed -n -e "s/^Description: *//p" $i) | 117 | summary=$(sed -n -e "s/^Description: *//p" $i) |
102 | package=${packagename}_${version}_$ARCH | 118 | package=${packagename}_${version}_$ARCH |
103 | ERROR= | 119 | ERROR= |
104 | if [ -z "$files" ] | 120 | if [ -z "$files" ] |
105 | then | 121 | then |
106 | mkdir -p $DATADIR/usr/share/doc/$packagename | 122 | mkdir -p $DATADIR/usr/share/doc/$packagename |
107 | else | 123 | else |
108 | for f in $files | 124 | for f in $files |
109 | do | 125 | do |
110 | if [ -d $f ] | 126 | if [ -d $f ] |
111 | then | 127 | then |
112 | ffiles=$(find $f -type f -o -type b -o -type c -o -type l) | 128 | ffiles=$(find $f -type f -o -type b -o -type c -o -type l) |
113 | else | 129 | else |
114 | ffiles=$f | 130 | ffiles=$f |
115 | fi | 131 | fi |
116 | for ff in $ffiles | 132 | for ff in $ffiles |
117 | do | 133 | do |
118 | case $ff in | 134 | case $ff in |
119 | */CVS/*) | 135 | */CVS/*) |
120 | continue | 136 | continue |
121 | ;;*~) | 137 | ;;*~) |
122 | continue | 138 | continue |
123 | ;;*.control) | 139 | ;;*.control) |
124 | continue | 140 | continue |
125 | ;; $QTDIR/*) | 141 | ;; $QTDIR/*) |
126 | BASE=$(dirname /opt/QtPalmtop/${ff#$QTDIR/}) | 142 | BASE=$(dirname /opt/QtPalmtop/${ff#$QTDIR/}) |
127 | ;; etc/*.d/*) | 143 | ;; etc/*.d/*) |
128 | BASE=$(dirname /$ff) | 144 | BASE=$(dirname /$ff) |
129 | ;; root/*) | 145 | ;; root/*) |
130 | BASE=$(dirname ${ff#root}) | 146 | BASE=$(dirname ${ff#root}) |
131 | ;; lib/*) | 147 | ;; lib/*) |
132 | BASE=$(dirname /opt/QtPalmtop/$ff) | 148 | BASE=$(dirname /opt/QtPalmtop/$ff) |
133 | ;; $OPIEDIR/lib/*) | 149 | ;; $OPIEDIR/lib/*) |
134 | BASE=$(dirname /opt/QtPalmtop/${ff#$OPIEDIR/}) | 150 | BASE=$(dirname /opt/QtPalmtop/${ff#$OPIEDIR/}) |
135 | ;; *) | 151 | ;; *) |
136 | # For SHARP ROM compatibility. Should change to Qtopia. | 152 | # For SHARP ROM compatibility. Should change to Qtopia. |
137 | BASE=/opt/QtPalmtop/$(dirname $ff) | 153 | BASE=/opt/QtPalmtop/$(dirname $ff) |
138 | esac | 154 | esac |
139 | 155 | ||
140 | if [ -f $ff -o -b $ff -o -c $ff ] | 156 | if [ -f $ff -o -b $ff -o -c $ff ] |
141 | then | 157 | then |
142 | D=$DATADIR$BASE | 158 | D=$DATADIR$BASE |
143 | if [ -x $ff -a -n "$STRIP" ] | 159 | if [ -x $ff -a -n "$STRIP" ] |
144 | then | 160 | then |
145 | case $(file $ff) in | 161 | case $(file $ff) in |
146 | $STRIP_FILES) | 162 | $STRIP_FILES) |
147 | $STRIP $ff | 163 | $STRIP $ff |
148 | ;; *) | 164 | ;; *) |
149 | esac | 165 | esac |
150 | fi | 166 | fi |
151 | if [ -n "$RPM" ] | 167 | if [ -n "$RPM" ] |
152 | then | 168 | then |
153 | case "$ff" in | 169 | case "$ff" in |
154 | /*) RPMFILES="$RPMFILES $ff" | 170 | /*) RPMFILES="$RPMFILES $ff" |
155 | ;; *) RPMFILES="$RPMFILES $OPIEDIR/$ff" | 171 | ;; *) RPMFILES="$RPMFILES $OPIEDIR/$ff" |
156 | esac | 172 | esac |
157 | else | 173 | else |
158 | mkdir -p $D | 174 | mkdir -p $D |
159 | if cp -a $ff $D | 175 | if cp -a $ff $D |
160 | then | 176 | then |
161 | true | 177 | true |
162 | else | 178 | else |
163 | ERROR=1 | 179 | ERROR=1 |
164 | fi | 180 | fi |
165 | fi | 181 | fi |
166 | else | 182 | else |
167 | echo >&2 "$0: $i: No such file: $ff" | 183 | echo >&2 "$0: $i: No such file: $ff" |
168 | ERROR=1 | 184 | ERROR=1 |
169 | fi | 185 | fi |
170 | done | 186 | done |
171 | done | 187 | done |
172 | fi | 188 | fi |
173 | if [ -z "$ERROR" ] | 189 | if [ -z "$ERROR" ] |
174 | then | 190 | then |
175 | if [ -n "$RPM" ] | 191 | if [ -n "$RPM" ] |
176 | then | 192 | then |
177 | SPEC=/tmp/mkipks-rpm-$$.spec | 193 | SPEC=/tmp/mkipks-rpm-$$.spec |
178 | echo >$SPEC "Summary: $summary" | 194 | echo >$SPEC "Summary: $summary" |
179 | echo >>$SPEC "Name: $packagename" | 195 | echo >>$SPEC "Name: $packagename" |
180 | echo >>$SPEC "Group: $section" ########## | 196 | echo >>$SPEC "Group: $section" ########## |
181 | echo >>$SPEC "License: $license" | 197 | echo >>$SPEC "License: $license" |
182 | echo >>$SPEC "Version: ${version%-*}" | 198 | echo >>$SPEC "Version: ${version%-*}" |
183 | echo >>$SPEC "Release: ${version#*-}" | 199 | echo >>$SPEC "Release: ${version#*-}" |
184 | 200 | ||
185 | echo >>$SPEC "%description" | 201 | echo >>$SPEC "%description" |
186 | sed -n -e '/^Description:/,$ p' $i | tail +2 >>$SPEC | 202 | sed -n -e '/^Description:/,$ p' $i | tail +2 >>$SPEC |
187 | echo >>$SPEC "%files" | 203 | echo >>$SPEC "%files" |
188 | echo >>$SPEC "%defattr(-,root,root)" | 204 | echo >>$SPEC "%defattr(-,root,root)" |
189 | /bin/ls $RPMFILES >>$SPEC | 205 | /bin/ls $RPMFILES >>$SPEC |
190 | rpm -bb --target $ARCH-unknown-linux $SPEC | 206 | rpm -bb --target $ARCH-unknown-linux $SPEC |
191 | # rm $SPEC | 207 | # rm $SPEC |
192 | elif [ -z "$IMAGEDIR" ] | 208 | elif [ -z "$IMAGEDIR" ] |
193 | then | 209 | then |
194 | #size=$(du -h -s $DATADIR | sed -e 's/[ ].*//') | 210 | #size=$(du -h -s $DATADIR | sed -e 's/[ ].*//') |
195 | if (which mkfs.jffs2 >/dev/null 2>&1); then | 211 | if (which mkfs.jffs2 >/dev/null 2>&1); then |
196 | size=$(mkfs.jffs2 -r $DATADIR | wc -c) | 212 | size=$(mkfs.jffs2 -r $DATADIR | wc -c) |
197 | fi | 213 | fi |
198 | echo "Package: $packagename" >$CTRLDIR/control | 214 | echo "Package: $packagename" >$CTRLDIR/control |
199 | if [ ! -z "$size" ]; then | 215 | if [ ! -z "$size" ]; then |
200 | echo "Installed-Size: $size" >>$CTRLDIR/control | 216 | echo "Installed-Size: $size" >>$CTRLDIR/control |
201 | else | 217 | else |
202 | if [ -z "$SIZEWARNED" ] | 218 | if [ -z "$SIZEWARNED" ] |
203 | then | 219 | then |
204 | echo "Warning, no mkfs.jffs2 found, unable to set Installed-Size." | 220 | echo "Warning, no mkfs.jffs2 found, unable to set Installed-Size." |
205 | SIZEWARNED=1 | 221 | SIZEWARNED=1 |
206 | fi | 222 | fi |
207 | fi | 223 | fi |
208 | echo "Architecture: $ARCH" >>$CTRLDIR/control | 224 | echo "Architecture: $ARCH" >>$CTRLDIR/control |
209 | echo "Filename: ./$package.ipk" >>$CTRLDIR/control | 225 | echo "Filename: ./$package.ipk" >>$CTRLDIR/control |
210 | echo "Version: $version" >>$CTRLDIR/control | 226 | echo "Version: $version" >>$CTRLDIR/control |
211 | [ ! -z "$depends" ] && echo "Depends: $depends" >>$CTRLDIR/control | 227 | [ ! -z "$depends" ] && echo "Depends: $depends" >>$CTRLDIR/control |
212 | [ ! -z "$provides" ] && echo "Provides: $provides" >>$CTRLDIR/control | 228 | [ ! -z "$provides" ] && echo "Provides: $provides" >>$CTRLDIR/control |
213 | [ ! -z "$conflicts" ] && echo "Conflicts: $conflicts" >>$CTRLDIR/control | 229 | [ ! -z "$conflicts" ] && echo "Conflicts: $conflicts" >>$CTRLDIR/control |
214 | egrep -v "^(Files|Version|Depends|Provides|Conflicts|Architecture):" >>$CTRLDIR/control $i | 230 | egrep -v "^(Files|Version|Depends|Provides|Conflicts|Architecture):" >>$CTRLDIR/control $i |
215 | [ -n "$classicopts" ] && echo "$DEB_VERSION" >$TDIR/debian-binary | 231 | [ -n "$classicopts" ] && echo "$DEB_VERSION" >$TDIR/debian-binary |
216 | base=${i%.control} | 232 | base=${i%.control} |
217 | scripts="preinst postinst prerm postrm" | 233 | scripts="preinst postinst prerm postrm" |
218 | for pf in $scripts | 234 | for pf in $scripts |
219 | do | 235 | do |
220 | if [ -e ${base}.$pf ] | 236 | if [ -e ${base}.$pf ] |
221 | then | 237 | then |
222 | cp ${base}.$pf $CTRLDIR/$pf | 238 | cp ${base}.$pf $CTRLDIR/$pf |
223 | chmod 755 $CTRLDIR/$pf | 239 | chmod 755 $CTRLDIR/$pf |
224 | fi | 240 | fi |
225 | done | 241 | done |
226 | cd $ORIGDIR; $OPIEDIR/scripts/ipkg-build $classicopts -o root -g root $TDIR; cd $OPIEDIR; | 242 | cd $ORIGDIR; $OPIEDIR/scripts/ipkg-build $classicopts -o root -g root $TDIR; cd $OPIEDIR; |
227 | RESULT=$package.ipk | 243 | RESULT=$package.ipk |
228 | if [ -n "$VERB" ] | 244 | if [ -n "$VERB" ] |
229 | then | 245 | then |
230 | echo >&2 "Built $RESULT ($size)" | 246 | echo >&2 "Built $RESULT ($size)" |
231 | fi | 247 | fi |
232 | if [ -n "$LIST" ] | 248 | if [ -n "$LIST" ] |
233 | then | 249 | then |
234 | echo $RESULT | 250 | echo $RESULT |
235 | fi | 251 | fi |
236 | fi | 252 | fi |
237 | else | 253 | else |
238 | echo >&2 "Not building $package package" | 254 | echo >&2 "Not building $package package" |
239 | fi | 255 | fi |
240 | done | 256 | done |
241 | # clean up | 257 | # clean up |
242 | rm -rf $TDIR | 258 | rm -rf $TDIR |