-rwxr-xr-x | scripts/GeneratePackageMake | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/GeneratePackageMake b/scripts/GeneratePackageMake index 099d3e8..9d692a9 100755 --- a/scripts/GeneratePackageMake +++ b/scripts/GeneratePackageMake | |||
@@ -1,228 +1,228 @@ | |||
1 | # generate file containg control name / package name / files | 1 | # generate file containg control name / package name / files |
2 | find . -name *.control | grep -v -- "-mt.control" | while read i | 2 | find . -name *.control | grep -v -- "-mt.control" | while read i |
3 | do | 3 | do |
4 | i=${i/.\//} | 4 | i=${i/.\//} |
5 | CDIR=${i%/*} | 5 | CDIR=${i%/*} |
6 | BNAME=${i##*/} | 6 | BNAME=${i##*/} |
7 | BNAME=${BNAME/.control/} | 7 | BNAME=${BNAME/.control/} |
8 | echo "cdir: ${CDIR}" | 8 | echo "cdir: ${CDIR}" |
9 | echo "bname: ${BNAME}" | 9 | echo "bname: ${BNAME}" |
10 | grep -e "Package:" -e "Files:" ./${i} | 10 | grep -e "Package:" -e "Files:" ./${i} |
11 | done > /tmp/ALL | 11 | done > /tmp/ALL |
12 | 12 | ||
13 | # | 13 | # |
14 | # makefile header | 14 | # makefile header |
15 | # | 15 | # |
16 | 16 | ||
17 | cat << MAKEFILEHEADER | 17 | cat << MAKEFILEHEADER |
18 | 18 | ||
19 | # | 19 | # |
20 | # generate -mt.control file from regular control | 20 | # generate -mt.control file from regular control |
21 | # arg 1 : path to control file to convert | 21 | # arg 1 : path to control file to convert |
22 | # | 22 | # |
23 | 23 | ||
24 | define GenerateMTControl | 24 | define GenerateMTControl |
25 | @echo "Generating -mt control file for \$(basename \$<)" | 25 | @echo "Generating -mt control file for \$(basename \$<)" |
26 | @\$(OPIEDIR)/scripts/tothreaded \$< \$(OPIEDIR)/AllThreadedPackages | 26 | @\$(OPIEDIR)/scripts/tothreaded \$< \$(OPIEDIR)/AllThreadedPackages |
27 | endef | 27 | endef |
28 | 28 | ||
29 | # | 29 | # |
30 | # package one control file | 30 | # package one control file |
31 | # arg 1 : directory from OPIEROOT where control file resides | 31 | # arg 1 : directory from OPIEROOT where control file resides |
32 | # arg 2 : control file basename without -mt (no .control) | 32 | # arg 2 : control file basename without -mt (no .control) |
33 | # arg 3 : control file basename with -mt if needed | 33 | # arg 3 : control file basename with -mt if needed |
34 | # arg 4 : package name (value specified by Package: ...) | 34 | # arg 4 : package name (value specified by Package: ...) |
35 | # | 35 | # |
36 | 36 | ||
37 | define DoPackage | 37 | define DoPackage |
38 | @echo \"Building ipk of \$(4)\" | 38 | echo \"Building ipk of \$(4)\" |
39 | @( \$(ForSubst) ) > \$(TOPDIR)/scripts/subst | 39 | ( \$(ForSubst) ) > \$(TOPDIR)/scripts/subst |
40 | @( \$(ForFileSubst) ) > \$(TOPDIR)/scripts/Filesubst | 40 | ( \$(ForFileSubst) ) > \$(TOPDIR)/scripts/Filesubst |
41 | @( cd \$(OPIEDIR); \\ | 41 | ( cd \$(OPIEDIR); \\ |
42 | \$(OPIEDIR)/scripts/mkipkg \\ | 42 | \$(OPIEDIR)/scripts/mkipkg \\ |
43 | --subst=\$(OPIEDIR)/scripts/subst \\ | 43 | --subst=\$(OPIEDIR)/scripts/subst \\ |
44 | --filesubst=\$(OPIEDIR)/scripts/filesubst \\ | 44 | --filesubst=\$(OPIEDIR)/scripts/filesubst \\ |
45 | --control=\$(OPIEDIR)/\$(1)/\$(3).control \\ | 45 | --control=\$(OPIEDIR)/\$(1)/\$(3).control \\ |
46 | --prerm=\$(OPIEDIR)/\$(1)/\$(2).prerm \\ | 46 | --prerm=\$(OPIEDIR)/\$(1)/\$(2).prerm \\ |
47 | --preinst=\$(OPIEDIR)/\$(1)/\$(2).preinst \\ | 47 | --preinst=\$(OPIEDIR)/\$(1)/\$(2).preinst \\ |
48 | --postrm=\$(OPIEDIR)/\$(1)/\$(2).postrm \\ | 48 | --postrm=\$(OPIEDIR)/\$(1)/\$(2).postrm \\ |
49 | --postinst=\$(OPIEDIR)/\$(1)/\$(2).postinst \\ | 49 | --postinst=\$(OPIEDIR)/\$(1)/\$(2).postinst \\ |
50 | --strip=\$(STRIP) \$(OPIEDIR); \\ | 50 | --strip=\$(STRIP) \$(OPIEDIR); \\ |
51 | rm -f \$(OPIEDIR)/Packages/\$(4)_*.ipk; \\ | 51 | rm -f \$(OPIEDIR)/Packages/\$(4)_*.ipk; \\ |
52 | mv *.ipk \$(OPIEDIR)/Packages; \\ | 52 | mv *.ipk \$(OPIEDIR)/Packages; \\ |
53 | touch \$(OPIEDIR)/Packages/\$(4) \\ | 53 | touch \$(OPIEDIR)/Packages/\$(4) \\ |
54 | ) || true | 54 | ) || true |
55 | endef | 55 | endef |
56 | 56 | ||
57 | # | 57 | # |
58 | # prepared for generating the substfile for every build | 58 | # prepared for generating the substfile for every build |
59 | # | 59 | # |
60 | 60 | ||
61 | define ForSubst | 61 | define ForSubst |
62 | echo 's,\\\$\$QPE_VERSION,\$(QPE_VERSION),g'; \\ | 62 | echo 's,\\\$\$QPE_VERSION,\$(QPE_VERSION),g'; \\ |
63 | echo 's,\\\$\$OPIE_VERSION,\$(OPIE_VERSION),g'; \\ | 63 | echo 's,\\\$\$OPIE_VERSION,\$(OPIE_VERSION),g'; \\ |
64 | echo 's,\\\$\$QTE_VERSION,\$(QTE_VERSION),g'; \\ | 64 | echo 's,\\\$\$QTE_VERSION,\$(QTE_VERSION),g'; \\ |
65 | echo 's,\\\$\$QTE_REVISION,\$(QTE_REVISION),g'; \\ | 65 | echo 's,\\\$\$QTE_REVISION,\$(QTE_REVISION),g'; \\ |
66 | echo 's,\\\$\$SUB_VERSION,\$(SUB_VERSION),g'; \\ | 66 | echo 's,\\\$\$SUB_VERSION,\$(SUB_VERSION),g'; \\ |
67 | echo 's,\\\$\$EXTRAVERSION,\$(EXTRAVERSION),g'; \\ | 67 | echo 's,\\\$\$EXTRAVERSION,\$(EXTRAVERSION),g'; \\ |
68 | echo 's,\\\$\$QTE_BASEVERSION,\$(QTE_BASEVERSION),g' | 68 | echo 's,\\\$\$QTE_BASEVERSION,\$(QTE_BASEVERSION),g' |
69 | endef | 69 | endef |
70 | 70 | ||
71 | define ForFileSubst | 71 | define ForFileSubst |
72 | echo 's,\\\$\$OPIEDIR/root/,/,g'; \\ | 72 | echo 's,\\\$\$OPIEDIR/root/,/,g'; \\ |
73 | echo 's,\$(OPIEDIR)/root/,/,g'; \\ | 73 | echo 's,\$(OPIEDIR)/root/,/,g'; \\ |
74 | echo 's,\\\$\$OPIEDIR,\$(prefix),g'; \\ | 74 | echo 's,\\\$\$OPIEDIR,\$(prefix),g'; \\ |
75 | echo 's,\$(OPIEDIR),\$(prefix),g'; \\ | 75 | echo 's,\$(OPIEDIR),\$(prefix),g'; \\ |
76 | echo 's,\\\$\$QTDIR,\$(prefix),g'; \\ | 76 | echo 's,\\\$\$QTDIR,\$(prefix),g'; \\ |
77 | echo 's,\$(QTDIR),\$(prefix),g'; \\ | 77 | echo 's,\$(QTDIR),\$(prefix),g'; \\ |
78 | echo 's,^\(\./\)*root/,/,g'; \\ | 78 | echo 's,^\(\./\)*root/,/,g'; \\ |
79 | echo 's,^\(\./\)*etc/,\$(prefix)/etc/,g'; \\ | 79 | echo 's,^\(\./\)*etc/,\$(prefix)/etc/,g'; \\ |
80 | echo 's,^\(\./\)*lib/,\$(prefix)/lib/,g'; \\ | 80 | echo 's,^\(\./\)*lib/,\$(prefix)/lib/,g'; \\ |
81 | echo 's,^\(\./\)*bin/,\$(prefix)/bin/,g'; \\ | 81 | echo 's,^\(\./\)*bin/,\$(prefix)/bin/,g'; \\ |
82 | echo 's,^\(\./\)*pics/,\$(prefix)/pics/,g'; \\ | 82 | echo 's,^\(\./\)*pics/,\$(prefix)/pics/,g'; \\ |
83 | echo 's,^\(\./\)*sounds/,\$(prefix)/sounds/,g'; \\ | 83 | echo 's,^\(\./\)*sounds/,\$(prefix)/sounds/,g'; \\ |
84 | echo 's,^\(\./\)*i18n/,\$(prefix)/i18n/,g'; \\ | 84 | echo 's,^\(\./\)*i18n/,\$(prefix)/i18n/,g'; \\ |
85 | echo 's,^\(\./\)*plugins/,\$(prefix)/plugins/,g'; \\ | 85 | echo 's,^\(\./\)*plugins/,\$(prefix)/plugins/,g'; \\ |
86 | echo 's,^\(\./\)*apps/,\$(prefix)/apps/,g'; \\ | 86 | echo 's,^\(\./\)*apps/,\$(prefix)/apps/,g'; \\ |
87 | echo 's,^\(\./\)*share/,\$(prefix)/share/,g'; \\ | 87 | echo 's,^\(\./\)*share/,\$(prefix)/share/,g'; \\ |
88 | echo 's,^\(\./\)*i18n/,\$(prefix)/i18n/,g'; \\ | 88 | echo 's,^\(\./\)*i18n/,\$(prefix)/i18n/,g'; \\ |
89 | echo 's,^\(\./\)*help/,\$(prefix)/help/,g' | 89 | echo 's,^\(\./\)*help/,\$(prefix)/help/,g' |
90 | endef | 90 | endef |
91 | 91 | ||
92 | # | 92 | # |
93 | # Will contain a list of all non-mt control files | 93 | # Will contain a list of all non-mt control files |
94 | ALLCONTROLFILES= | 94 | ALLCONTROLFILES= |
95 | 95 | ||
96 | # | 96 | # |
97 | # Will contain a list of all packaging targets | 97 | # Will contain a list of all packaging targets |
98 | ALLPACKAGES= | 98 | ALLPACKAGES= |
99 | 99 | ||
100 | # s contains now single space | 100 | # s contains now single space |
101 | s=\$(x) \$(x) | 101 | s=\$(x) \$(x) |
102 | 102 | ||
103 | # | 103 | # |
104 | # for convenience : generate AllTh | 104 | # for convenience : generate AllTh |
105 | ATP=\$(OPIEDIR)/AllThreadedPackages | 105 | ATP=\$(OPIEDIR)/AllThreadedPackages |
106 | 106 | ||
107 | MAKEFILEHEADER | 107 | MAKEFILEHEADER |
108 | 108 | ||
109 | while read k | 109 | while read k |
110 | do | 110 | do |
111 | CDIR="${k#* }" | 111 | CDIR="${k#* }" |
112 | read k | 112 | read k |
113 | BNAME="${k#* }" | 113 | BNAME="${k#* }" |
114 | read k | 114 | read k |
115 | case $k in | 115 | case $k in |
116 | *"ackage:"*) | 116 | *"ackage:"*) |
117 | Pkg="${k#* }" | 117 | Pkg="${k#* }" |
118 | Pkg="${Pkg// }" | 118 | Pkg="${Pkg// }" |
119 | ;; | 119 | ;; |
120 | *"iles:"*) | 120 | *"iles:"*) |
121 | Files="${k/Files:/}" | 121 | Files="${k/Files:/}" |
122 | ;; | 122 | ;; |
123 | esac | 123 | esac |
124 | read k | 124 | read k |
125 | case $k in | 125 | case $k in |
126 | *"ackage:"*) | 126 | *"ackage:"*) |
127 | Pkg="${k#* }" | 127 | Pkg="${k#* }" |
128 | Pkg="${Pkg// }" | 128 | Pkg="${Pkg// }" |
129 | ;; | 129 | ;; |
130 | *"iles:"*) | 130 | *"iles:"*) |
131 | Files="${k/Files:/}" | 131 | Files="${k/Files:/}" |
132 | ;; | 132 | ;; |
133 | esac | 133 | esac |
134 | 134 | ||
135 | cat << HERE | 135 | cat << HERE |
136 | # | 136 | # |
137 | # package $Pkg in ${BNAME} | 137 | # package $Pkg in ${BNAME} |
138 | # | 138 | # |
139 | 139 | ||
140 | package-${Pkg} : \$(OPIEDIR)/Packages/$Pkg | 140 | package-${Pkg} : \$(OPIEDIR)/Packages/$Pkg |
141 | package-${Pkg}-mt : \$(ATP) \$(OPIEDIR)/Packages/$Pkg-mt | 141 | package-${Pkg}-mt : \$(ATP) \$(OPIEDIR)/Packages/$Pkg-mt |
142 | 142 | ||
143 | # collect control files and package targets | 143 | # collect control files and package targets |
144 | 144 | ||
145 | ALLCONTROLFILES += ${CDIR}/${BNAME}.control | 145 | ALLCONTROLFILES += ${CDIR}/${BNAME}.control |
146 | ALLPACKAGES += $Pkg | 146 | ALLPACKAGES += $Pkg |
147 | 147 | ||
148 | # to generate -mt control file | 148 | # to generate -mt control file |
149 | \$(OPIEDIR)/${CDIR}/${BNAME}-mt.control : \$(OPIEDIR)/${CDIR}/${BNAME}.control | 149 | \$(OPIEDIR)/${CDIR}/${BNAME}-mt.control : \$(OPIEDIR)/${CDIR}/${BNAME}.control |
150 | \$(GenerateMTControl) | 150 | \$(GenerateMTControl) |
151 | 151 | ||
152 | HERE | 152 | HERE |
153 | 153 | ||
154 | if [ ! -z "${Files}" ] | 154 | if [ ! -z "${Files}" ] |
155 | then | 155 | then |
156 | 156 | ||
157 | cat << HERE | 157 | cat << HERE |
158 | # optimize speed | 158 | # optimize speed |
159 | .phony : \$(wildcard \$(addprefix \$(OPIEDIR)/,${Files})) | 159 | .phony : \$(wildcard \$(addprefix \$(OPIEDIR)/,${Files})) |
160 | 160 | ||
161 | # capture missing files (because not built) | 161 | # capture missing files (because not built) |
162 | \$(OPIEDIR)/Packages/$Pkg \$(OPIEDIR)/Packages/$Pkg-mt \$(SUBSTFILES): \$(wildcard \$(addprefix \$(OPIEDIR)/,${Files})) | 162 | \$(OPIEDIR)/Packages/$Pkg \$(OPIEDIR)/Packages/$Pkg-mt \$(SUBSTFILES): \$(wildcard \$(addprefix \$(OPIEDIR)/,${Files})) |
163 | HERE | 163 | HERE |
164 | 164 | ||
165 | # echo "\$(wildcard \$(addprefix \$(OPIEDIR)/,${Files})) : " | 165 | # echo "\$(wildcard \$(addprefix \$(OPIEDIR)/,${Files})) : " |
166 | 166 | ||
167 | fi | 167 | fi |
168 | 168 | ||
169 | cat << HERE | 169 | cat << HERE |
170 | \$(OPIEDIR)/Packages/$Pkg : \$(OPIEDIR)/${CDIR}/${BNAME}.control | 170 | \$(OPIEDIR)/Packages/$Pkg : \$(OPIEDIR)/${CDIR}/${BNAME}.control |
171 | @\$(call DoPackage,${CDIR},${BNAME},${BNAME},${Pkg}) | 171 | @\$(call DoPackage,${CDIR},${BNAME},${BNAME},${Pkg}) |
172 | \$(OPIEDIR)/Packages/$Pkg-mt : \$(OPIEDIR)/${CDIR}/${BNAME}-mt.control | 172 | \$(OPIEDIR)/Packages/$Pkg-mt : \$(OPIEDIR)/${CDIR}/${BNAME}-mt.control |
173 | @\$(call DoPackage,${CDIR},${BNAME},${BNAME}-mt,${Pkg}-mt) | 173 | @\$(call DoPackage,${CDIR},${BNAME},${BNAME}-mt,${Pkg}-mt) |
174 | 174 | ||
175 | HERE | 175 | HERE |
176 | 176 | ||
177 | done < /tmp/ALL | 177 | done < /tmp/ALL |
178 | 178 | ||
179 | cat << HERE | 179 | cat << HERE |
180 | # | 180 | # |
181 | # regenerate package file if control files are modified | 181 | # regenerate package file if control files are modified |
182 | # | 182 | # |
183 | 183 | ||
184 | Package.make : \$(addprefix \$(OPIEDIR)/,\$(ALLCONTROLFILES)) | 184 | Package.make : \$(addprefix \$(OPIEDIR)/,\$(ALLCONTROLFILES)) |
185 | 185 | ||
186 | # | 186 | # |
187 | # make targets to build packages | 187 | # make targets to build packages |
188 | # needs quicklauncher link in location (because dangling | 188 | # needs quicklauncher link in location (because dangling |
189 | # links are not considered as true files by the wildcard command) | 189 | # links are not considered as true files by the wildcard command) |
190 | # | 190 | # |
191 | # if you want to build one package only then use | 191 | # if you want to build one package only then use |
192 | # make package-<basenameof control> | 192 | # make package-<basenameof control> |
193 | # or make package-<basenameof control>-mt | 193 | # or make package-<basenameof control>-mt |
194 | # | 194 | # |
195 | 195 | ||
196 | packages : /opt/QtPalmtop/bin/quicklauncher \\ | 196 | packages : /opt/QtPalmtop/bin/quicklauncher \\ |
197 | \$(OPIEDIR)/Packages \\ | 197 | \$(OPIEDIR)/Packages \\ |
198 | \$(add prefix \$(OPIEDIR)/Packages/,\$(ALLPACKAGES)) | 198 | \$(add prefix \$(OPIEDIR)/Packages/,\$(ALLPACKAGES)) |
199 | packages-mt : /opt/QtPalmtop/bin/quicklauncher \\ | 199 | packages-mt : /opt/QtPalmtop/bin/quicklauncher \\ |
200 | \$(ATP) \\ | 200 | \$(ATP) \\ |
201 | \$(OPIEDIR)/Packages \\ | 201 | \$(OPIEDIR)/Packages \\ |
202 | \$(addprefix \$(OPIEDIR)/Packages/,\$(addsuffix -mt,\$(ALLPACKAGES))) | 202 | \$(addprefix \$(OPIEDIR)/Packages/,\$(addsuffix -mt,\$(ALLPACKAGES))) |
203 | 203 | ||
204 | # | 204 | # |
205 | # capture missing quichlauncher link | 205 | # capture missing quichlauncher link |
206 | # | 206 | # |
207 | 207 | ||
208 | /opt/QtPalmtop/bin/quicklauncher : | 208 | /opt/QtPalmtop/bin/quicklauncher : |
209 | @echo "create a link from /opt/QtPalmtop to \$(OPIEDIR) for this target to work" | 209 | @echo "create a link from /opt/QtPalmtop to \$(OPIEDIR) for this target to work" |
210 | exit 2 | 210 | exit 2 |
211 | 211 | ||
212 | # | 212 | # |
213 | # Create Packages directory | 213 | # Create Packages directory |
214 | # | 214 | # |
215 | 215 | ||
216 | \$(OPIEDIR)/Packages : | 216 | \$(OPIEDIR)/Packages : |
217 | @mkdir \$(OPIEDIR)/Packages | 217 | @mkdir \$(OPIEDIR)/Packages |
218 | 218 | ||
219 | # | 219 | # |
220 | # update file containing all packages | 220 | # update file containing all packages |
221 | # | 221 | # |
222 | 222 | ||
223 | \$(ATP) : \$(addprefix \$(OPIEDIR)/,\$(ALLCONTROLFILES)) | 223 | \$(ATP) : \$(addprefix \$(OPIEDIR)/,\$(ALLCONTROLFILES)) |
224 | @echo "Generating \$(notdir \$(ATP))" | 224 | @echo "Generating \$(notdir \$(ATP))" |
225 | @echo -e "\$(subst \$(s),,\$(foreach i,\$(ALLPACKAGES),\$(i)\n))" > \$@ | 225 | @echo -e "\$(subst \$(s),,\$(foreach i,\$(ALLPACKAGES),\$(i)\n))" > \$@ |
226 | HERE | 226 | HERE |
227 | 227 | ||
228 | rm /tmp/ALL | 228 | rm /tmp/ALL |