Test initialisation of MUIA_List_AdjustWidth and MUIA_List_AdjustHeight, and
[AROS.git] / arch / all-pc / acpica / generate / release / build.sh
blob5b8cd75107fd1824ea5091920199ce14af019fc6
1 #!/bin/bash
3 #******************************************************************************
5 # ACPICA package generation script for Cygwin/Windows execution
7 # Requires cygwin be installed - http://www.cygwin.com
8 # and its /bin be *first* in your path.
10 # Windows packages require pkzip25 (free, and is available from numerous
11 # sources - search for "pkzip25" or "pkzip25.exe")
13 # Execute this script from the acpica/generate/release directory.
15 # Constructed packages are placed in the acpica/generate/release/current
16 # directory.
18 # Line Terminators: Windows source packages leave the CR/LF terminator.
19 # Unix packages convert the CR/LF terminators to LF only.
21 # Usage:
23 # build <package_type> <target_type>
25 # where:
26 # <package_type> is one of:
27 # source - Build an ACPICA source package (core and all tools)
28 # test - Build an ACPICA test suite package
29 # binary - Build an ACPICA binary tools package
31 # <target_type> is one of:
32 # win - Generate Windows package (Intel license, CRLF line terminators)
33 # unix - Generate Unix package (Intel license, LF line terminators)
34 # unix2 - Generate Unix package (dual license, LF line terminators)
36 #******************************************************************************
38 # Configuration
40 ZIP_UTILITY="/cygdrive/c/windows/pkzip25.exe"
41 ACPISRC="libraries/acpisrc.exe"
42 DOS2UNIX="dos2unix"
43 UNIX2DOS="unix2dos"
45 # Filenames and paths
47 TARGET_DIR="generate/release/current"
48 TEMP_DIR=acpitemp
49 TEST_PREFIX=acpitests
50 SOURCE_PREFIX=acpica
51 BINARY_PREFIX=iasl
52 PACKAGE_SUFFIX=`date +%Y%m%d`
54 NPARAM=$#
57 #******************************************************************************
59 # Miscellaneous utility functions
61 #******************************************************************************
63 usage()
65 echo "$1"
66 echo
67 echo "Low-level build script for ACPICA release packages"
68 echo "Usage:"
69 echo " $0 source <win | unix | unix2>"
70 echo " $0 test <win | unix>"
71 echo " $0 binary <win>"
74 banner()
76 echo
77 echo "$1"
78 echo
81 check_zip_utility_exists()
84 # Need pkzip (or similar) to build the windows packages
86 if [ ! -e "$ZIP_UTILITY" ]; then
87 echo "ZIP_UTILITY ($ZIP_UTILITY) does not exist!"
88 exit 1
92 convert_to_unix_line_terminators()
95 # Convert all CR/LF pairs to Unix format (LF only)
97 cd $TEMP_DIR
98 echo Starting CR/LF to LF Conversion
99 find . -name "*" | xargs $DOS2UNIX
100 echo Completed CR/LF to LF Conversion
101 cd ..
104 convert_to_dos_line_terminators()
107 # Convert all lone LF terminators to CR/LF
108 # Note: Checks shell scripts only (*.sh)
110 cd $TEMP_DIR
111 echo Starting LF to CR/LF Conversion
112 find . -name "*.sh" | xargs $UNIX2DOS
113 echo Completed LF to CR/LF Conversion
114 cd ..
117 insert_dual_license_headers()
120 # Need acpisrc utility to insert the headers
122 if [ ! -e "$ACPISRC" ]; then
123 echo "acpisrc ($ACPISRC) does not exist!"
124 exit 1
128 # Insert the dual license into *.c and *.h files
130 echo "Inserting dual-license into all source files"
131 $ACPISRC -h -y $TEMP_DIR
134 build_unix_package()
136 convert_to_unix_line_terminators
139 # Build release package
141 rm -r -f $PACKAGE_FILENAME
142 mv $TEMP_DIR $PACKAGE_FILENAME
143 tar czf $PACKAGE_FILENAME.tar.gz $PACKAGE_FILENAME
146 # Move the completed package
148 mv $PACKAGE_FILENAME.tar.gz $TARGET_DIR
149 mv $PACKAGE_FILENAME $TEMP_DIR
152 build_windows_package()
154 convert_to_dos_line_terminators
157 # Build release package
159 cd $TEMP_DIR
160 rm -r -f ../$TARGET_DIR/$PACKAGE_FILENAME
161 $ZIP_UTILITY -add -max -dir -sort=name ../$TARGET_DIR/$PACKAGE_FILENAME
162 cd ..
166 #******************************************************************************
168 # generate_source_package
170 # Generates the ACPICA source code packages (core and all tools)
172 # Arguments:
173 # %1 - Target type (win or unix or unix2)
175 #******************************************************************************
177 generate_source_package ()
180 # Parameter evaluation
182 if [ $1 == win ]; then
183 PACKAGE_NAME=Windows
184 PACKAGE_TYPE=Win
185 LICENSE=Intel
186 check_zip_utility_exists
188 elif [ $1 == unix ]; then
189 PACKAGE_NAME="Unix (Intel License)"
190 PACKAGE_TYPE=Unix
191 LICENSE=Intel
193 elif [ $1 == unix2 ]; then
194 PACKAGE_NAME="Unix (Dual License)"
195 PACKAGE_TYPE=Unix
196 LICENSE=Dual
198 else
199 usage "Invalid argument ($1)"
200 exit 1
203 PACKAGE_FILENAME=$SOURCE_PREFIX-$1-$PACKAGE_SUFFIX
204 banner "ACPICA - Generating $PACKAGE_NAME source code package ($PACKAGE_FILENAME)"
207 # Make directories common to all source packages
209 mkdir $TEMP_DIR
210 mkdir $TEMP_DIR/libraries
211 mkdir $TEMP_DIR/generate
212 mkdir $TEMP_DIR/generate/lint
213 mkdir $TEMP_DIR/generate/release
214 mkdir $TEMP_DIR/generate/unix
215 mkdir $TEMP_DIR/generate/unix/acpibin
216 mkdir $TEMP_DIR/generate/unix/acpidump
217 mkdir $TEMP_DIR/generate/unix/acpiexec
218 mkdir $TEMP_DIR/generate/unix/acpihelp
219 mkdir $TEMP_DIR/generate/unix/acpinames
220 mkdir $TEMP_DIR/generate/unix/acpisrc
221 mkdir $TEMP_DIR/generate/unix/acpixtract
222 mkdir $TEMP_DIR/generate/unix/iasl
223 mkdir $TEMP_DIR/tests
224 mkdir $TEMP_DIR/tests/misc
225 mkdir $TEMP_DIR/tests/templates
226 mkdir -p $TEMP_DIR/source/os_specific/service_layers
229 # Copy ACPICA subsystem source code
231 cp -r documents/changes.txt $TEMP_DIR/changes.txt
232 cp -r source/common $TEMP_DIR/source/common
233 cp -r source/components $TEMP_DIR/source/
234 cp -r source/include $TEMP_DIR/source/include
235 cp -r generate/release/*.sh $TEMP_DIR/generate/release
238 # Copy iASL compiler and tools source
240 cp -r source/compiler $TEMP_DIR/source/compiler
241 cp -r source/tools $TEMP_DIR/source/tools
244 # Copy iASL/ACPICA miscellaneous tests (not full test suites)
246 cp -r tests/misc/*.asl $TEMP_DIR/tests/misc
247 cp -r tests/templates/Makefile $TEMP_DIR/tests/templates
248 cp -r tests/templates/templates.sh $TEMP_DIR/tests/templates
251 # Copy all OS-specific interfaces
253 cp source/os_specific/service_layers/*.c $TEMP_DIR/source/os_specific/service_layers
256 # Copy generic UNIX makefiles
258 cp Makefile $TEMP_DIR
259 cp generate/unix/readme.txt $TEMP_DIR/generate/unix/readme.txt
260 cp generate/unix/Makefile* $TEMP_DIR/generate/unix
261 cp generate/unix/acpibin/Makefile $TEMP_DIR/generate/unix/acpibin
262 cp generate/unix/acpidump/Makefile $TEMP_DIR/generate/unix/acpidump
263 cp generate/unix/acpiexec/Makefile $TEMP_DIR/generate/unix/acpiexec
264 cp generate/unix/acpihelp/Makefile $TEMP_DIR/generate/unix/acpihelp
265 cp generate/unix/acpinames/Makefile $TEMP_DIR/generate/unix/acpinames
266 cp generate/unix/acpisrc/Makefile $TEMP_DIR/generate/unix/acpisrc
267 cp generate/unix/acpixtract/Makefile $TEMP_DIR/generate/unix/acpixtract
268 cp generate/unix/iasl/Makefile $TEMP_DIR/generate/unix/iasl
271 # Copy Lint directory
273 cp -r generate/lint $TEMP_DIR/generate
274 rm -f $TEMP_DIR/generate/lint/co*
275 rm -f $TEMP_DIR/generate/lint/env*
276 rm -f $TEMP_DIR/generate/lint/lib*
277 rm -f $TEMP_DIR/generate/lint/LintOut.txt
279 if [ $PACKAGE_TYPE == Unix ]; then
281 # Unix/Linux-specific activities
283 # For Unix2 case, insert the dual license header into all source files
285 if [ $LICENSE == Dual ]; then
286 insert_dual_license_headers
289 build_unix_package
291 else
293 # Windows-specific activities
296 # Copy project files for MS Visual Studio 2008 (VC++ 9.0)
298 mkdir $TEMP_DIR/generate/msvc9
299 cp -r generate/msvc9/*.sln $TEMP_DIR/generate/msvc9/
300 cp -r generate/msvc9/*.vcproj $TEMP_DIR/generate/msvc9/
302 build_windows_package
305 banner "ACPICA - Completed $PACKAGE_NAME source code package ($PACKAGE_FILENAME)"
309 #******************************************************************************
311 # generate_test_package
313 # Generates the ACPICA test suite packages
315 # Arguments:
316 # %1 - Target type (win or unix)
318 #******************************************************************************
320 generate_test_package()
323 # Parameter evaluation
325 if [ $1 == win ]; then
326 PACKAGE_NAME=Windows
327 PACKAGE_TYPE=Win
328 check_zip_utility_exists
330 elif [ $1 == unix ]; then
331 PACKAGE_NAME="Unix"
332 PACKAGE_TYPE=Unix
334 else
335 usage "Invalid argument ($1)"
336 exit 1
339 PACKAGE_FILENAME=$TEST_PREFIX-$1-$PACKAGE_SUFFIX
340 banner "ACPICA - Generating $PACKAGE_NAME test suite package ($PACKAGE_FILENAME)"
343 # Copy the ASL Test source
345 mkdir $TEMP_DIR
346 cp -r tests $TEMP_DIR/tests
349 # Delete extraneous files
351 cd $TEMP_DIR
352 find . -name "tmp" | xargs rm -r -f
353 find . -name "aml" | xargs rm -r -f
354 find . -name "CVS" | xargs rm -r -f
355 cd ..
357 if [ $PACKAGE_TYPE == Unix ]; then
359 # Unix/Linux-specific activities
361 build_unix_package
363 else
365 # Windows-specific activities
367 build_windows_package
370 banner "ACPICA - Completed $PACKAGE_NAME test suite package ($PACKAGE_FILENAME)"
374 #******************************************************************************
376 # generate_binary_package
378 # Generates the ACPICA binary package (Currently Windows only)
380 # Arguments:
381 # %1 - Target type (win)
383 #******************************************************************************
385 generate_binary_package()
388 # Parameter evaluation
390 if [ $1 == win ]; then
391 PACKAGE_NAME=Windows
392 PACKAGE_TYPE=Win
393 check_zip_utility_exists
395 else
396 usage "Invalid argument ($1)"
397 exit 1
400 PACKAGE_FILENAME=$BINARY_PREFIX-$1-$PACKAGE_SUFFIX
401 banner "ACPICA - Generating $PACKAGE_NAME binary tools package ($PACKAGE_FILENAME)"
404 # Copy executables and documentation
406 mkdir $TEMP_DIR
407 cp -r documents/changes.txt $TEMP_DIR/changes.txt
408 cp documents/aslcompiler.pdf $TEMP_DIR
409 cp libraries/acpibin.exe $TEMP_DIR
410 cp libraries/acpidump.exe $TEMP_DIR
411 cp libraries/acpiexec.exe $TEMP_DIR
412 cp libraries/acpihelp.exe $TEMP_DIR
413 cp libraries/acpinames.exe $TEMP_DIR
414 cp libraries/acpisrc.exe $TEMP_DIR
415 cp libraries/acpixtract.exe $TEMP_DIR
416 cp libraries/iasl.exe $TEMP_DIR
417 cp tests/misc/badcode.asl $TEMP_DIR
419 build_windows_package
420 banner "ACPICA - Completed $PACKAGE_NAME binary tools package ($PACKAGE_FILENAME)"
424 #******************************************************************************
426 # main
428 # Arguments:
429 # $1 (package_type) is one of:
430 # source - Build an ACPICA source package (core and all tools)
431 # test - Build an ACPICA test suite package
432 # binary - Build an ACPICA binary tools package
434 # $2 (target_type) is one of:
435 # win - Generate Windows package (Intel license, CRLF line terminators)
436 # unix - Generate Unix package (Intel license, LF line terminators)
437 # unix2 - Generate Unix package (dual license, LF line terminators)
439 #******************************************************************************
441 set -e # Abort on any error
443 if [ $NPARAM -ne 2 ]; then
444 usage "Wrong argument count ($NPARAM)"
445 exit 1
449 # cd from acpica/generate/release to acpica
451 cd ../..
454 # Ensure that the temporary directory is created fresh
456 rm -rf $TEMP_DIR
459 # Parameter evaluation
461 if [ $1 == source ]; then
462 generate_source_package $2
464 elif [ $1 == test ]; then
465 generate_test_package $2
467 elif [ $1 == binary ]; then
468 generate_binary_package $2
470 else
471 usage "Invalid argument ($1)"
472 exit 1
476 # Remove temporary directory
478 rm -rf $TEMP_DIR