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
18 # Line Terminators: Windows source packages leave the CR/LF terminator.
19 # Unix packages convert the CR/LF terminators to LF only.
23 # build <package_type> <target_type>
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 #******************************************************************************
40 ZIP_UTILITY="/cygdrive/c/windows/pkzip25.exe"
41 ACPISRC="libraries/acpisrc.exe"
47 TARGET_DIR="generate/release/current"
52 PACKAGE_SUFFIX=`date +%Y%m%d`
57 #******************************************************************************
59 # Miscellaneous utility functions
61 #******************************************************************************
67 echo "Low-level build script for ACPICA release packages"
69 echo " $0 source <win | unix | unix2>"
70 echo " $0 test <win | unix>"
71 echo " $0 binary <win>"
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!"
92 convert_to_unix_line_terminators()
95 # Convert all CR/LF pairs to Unix format (LF only)
98 echo "Starting CR/LF to LF (UNIX) full source conversion"
99 find . -name "*" | xargs $DOS2UNIX -q
100 echo "Completed CR/LF to LF (UNIX) full source conversion"
104 convert_to_dos_line_terminators()
107 # Convert all lone LF terminators to CR/LF
108 # Note: Checks shell scripts only (*.sh)
111 echo "Starting LF to CR/LF (DOS) script conversion"
112 find . -name "*.sh" | xargs $UNIX2DOS -q
113 echo "Completed LF to CR/LF (DOS) script conversion"
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!"
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
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
160 rm -r -f ../$TARGET_DIR/$PACKAGE_FILENAME
161 $ZIP_UTILITY -silent -add -max -dir -sort=name ../$TARGET_DIR/$PACKAGE_FILENAME
166 #******************************************************************************
168 # generate_source_package
170 # Generates the ACPICA source code packages (core and all tools)
173 # %1 - Target type (win or unix or unix2)
175 #******************************************************************************
177 generate_source_package ()
180 # Parameter evaluation
182 if [ $1 == win ]; then
186 check_zip_utility_exists
188 elif [ $1 == unix ]; then
189 PACKAGE_NAME="Unix (Intel License)"
193 elif [ $1 == unix2 ]; then
194 PACKAGE_NAME="Unix (Dual License)"
199 usage "Invalid argument ($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
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/acpiexamples
218 mkdir $TEMP_DIR/generate/unix/acpiexec
219 mkdir $TEMP_DIR/generate/unix/acpihelp
220 mkdir $TEMP_DIR/generate/unix/acpinames
221 mkdir $TEMP_DIR/generate/unix/acpisrc
222 mkdir $TEMP_DIR/generate/unix/acpixtract
223 mkdir $TEMP_DIR/generate/unix/iasl
224 mkdir $TEMP_DIR/tests
225 mkdir $TEMP_DIR/tests/misc
226 mkdir $TEMP_DIR/tests/templates
227 mkdir -p $TEMP_DIR/source/os_specific/service_layers
230 # Copy ACPICA subsystem source code
232 cp -r documents/changes.txt $TEMP_DIR/changes.txt
233 cp -r source/common $TEMP_DIR/source/common
234 cp -r source/components $TEMP_DIR/source/
235 cp -r source/include $TEMP_DIR/source/include
236 cp -r generate/release/*.sh $TEMP_DIR/generate/release
239 # Copy iASL compiler and tools source
241 cp -r source/compiler $TEMP_DIR/source/compiler
242 cp -r source/tools $TEMP_DIR/source/tools
245 # Copy iASL/ACPICA miscellaneous tests (not full test suites)
247 cp -r tests/misc/*.asl $TEMP_DIR/tests/misc
248 cp -r tests/templates/Makefile $TEMP_DIR/tests/templates
249 cp -r tests/templates/templates.sh $TEMP_DIR/tests/templates
252 # Copy all OS-specific interfaces
254 cp source/os_specific/service_layers/*.c $TEMP_DIR/source/os_specific/service_layers
257 # Copy generic UNIX makefiles
259 cp Makefile $TEMP_DIR
260 cp generate/unix/readme.txt $TEMP_DIR/generate/unix/readme.txt
261 cp generate/unix/Makefile* $TEMP_DIR/generate/unix
262 cp generate/unix/acpibin/Makefile $TEMP_DIR/generate/unix/acpibin
263 cp generate/unix/acpidump/Makefile $TEMP_DIR/generate/unix/acpidump
264 cp generate/unix/acpiexamples/Makefile $TEMP_DIR/generate/unix/acpiexamples
265 cp generate/unix/acpiexec/Makefile $TEMP_DIR/generate/unix/acpiexec
266 cp generate/unix/acpihelp/Makefile $TEMP_DIR/generate/unix/acpihelp
267 cp generate/unix/acpinames/Makefile $TEMP_DIR/generate/unix/acpinames
268 cp generate/unix/acpisrc/Makefile $TEMP_DIR/generate/unix/acpisrc
269 cp generate/unix/acpixtract/Makefile $TEMP_DIR/generate/unix/acpixtract
270 cp generate/unix/iasl/Makefile $TEMP_DIR/generate/unix/iasl
273 # Copy Lint directory
275 cp -r generate/lint $TEMP_DIR/generate
276 rm -f $TEMP_DIR/generate/lint/co*
277 rm -f $TEMP_DIR/generate/lint/env*
278 rm -f $TEMP_DIR/generate/lint/lib*
279 rm -f $TEMP_DIR/generate/lint/LintOut.txt
281 if [ $PACKAGE_TYPE == Unix ]; then
283 # Unix/Linux-specific activities
285 # For Unix2 case, insert the dual license header into all source files
287 if [ $LICENSE == Dual ]; then
288 insert_dual_license_headers
295 # Windows-specific activities
298 # Copy project files for MS Visual Studio 2008 (VC++ 9.0)
300 mkdir $TEMP_DIR/generate/msvc9
301 cp -r generate/msvc9/*.sln $TEMP_DIR/generate/msvc9/
302 cp -r generate/msvc9/*.vcproj $TEMP_DIR/generate/msvc9/
304 build_windows_package
307 banner "ACPICA - Completed $PACKAGE_NAME source code package ($PACKAGE_FILENAME)"
311 #******************************************************************************
313 # generate_test_package
315 # Generates the ACPICA test suite packages
318 # %1 - Target type (win or unix)
320 #******************************************************************************
322 generate_test_package()
325 # Parameter evaluation
327 if [ $1 == win ]; then
330 check_zip_utility_exists
332 elif [ $1 == unix ]; then
337 usage "Invalid argument ($1)"
341 PACKAGE_FILENAME=$TEST_PREFIX-$1-$PACKAGE_SUFFIX
342 banner "ACPICA - Generating $PACKAGE_NAME test suite package ($PACKAGE_FILENAME)"
345 # Copy the ASL Test source
348 cp -r tests $TEMP_DIR/tests
351 # Delete extraneous files
354 find . -name "tmp" | xargs rm -r -f
355 find . -name "aml" | xargs rm -r -f
356 find . -name "CVS" | xargs rm -r -f
359 if [ $PACKAGE_TYPE == Unix ]; then
361 # Unix/Linux-specific activities
367 # Windows-specific activities
369 build_windows_package
372 banner "ACPICA - Completed $PACKAGE_NAME test suite package ($PACKAGE_FILENAME)"
376 #******************************************************************************
378 # generate_binary_package
380 # Generates the ACPICA binary package (Currently Windows only)
383 # %1 - Target type (win)
385 #******************************************************************************
387 generate_binary_package()
390 # Parameter evaluation
392 if [ $1 == win ]; then
395 check_zip_utility_exists
398 usage "Invalid argument ($1)"
402 PACKAGE_FILENAME=$BINARY_PREFIX-$1-$PACKAGE_SUFFIX
403 banner "ACPICA - Generating $PACKAGE_NAME binary tools package ($PACKAGE_FILENAME)"
406 # Copy executables and documentation
409 cp -r documents/changes.txt $TEMP_DIR/changes.txt
410 cp documents/aslcompiler.pdf $TEMP_DIR
411 cp libraries/acpibin.exe $TEMP_DIR
412 cp libraries/acpidump.exe $TEMP_DIR
413 cp libraries/acpiexec.exe $TEMP_DIR
414 cp libraries/acpihelp.exe $TEMP_DIR
415 cp libraries/acpinames.exe $TEMP_DIR
416 cp libraries/acpisrc.exe $TEMP_DIR
417 cp libraries/acpixtract.exe $TEMP_DIR
418 cp libraries/iasl.exe $TEMP_DIR
419 cp tests/misc/badcode.asl $TEMP_DIR
421 build_windows_package
422 banner "ACPICA - Completed $PACKAGE_NAME binary tools package ($PACKAGE_FILENAME)"
426 #******************************************************************************
431 # $1 (package_type) is one of:
432 # source - Build an ACPICA source package (core and all tools)
433 # test - Build an ACPICA test suite package
434 # binary - Build an ACPICA binary tools package
436 # $2 (target_type) is one of:
437 # win - Generate Windows package (Intel license, CRLF line terminators)
438 # unix - Generate Unix package (Intel license, LF line terminators)
439 # unix2 - Generate Unix package (dual license, LF line terminators)
441 #******************************************************************************
443 set -e # Abort on any error
445 if [ $NPARAM -ne 2 ]; then
446 usage "Wrong argument count ($NPARAM)"
451 # cd from acpica/generate/release to acpica
456 # Ensure that the temporary directory is created fresh
461 # Parameter evaluation
463 if [ $1 == source ]; then
464 generate_source_package $2
466 elif [ $1 == test ]; then
467 generate_test_package $2
469 elif [ $1 == binary ]; then
470 generate_binary_package $2
473 usage "Invalid argument ($1)"
478 # Remove temporary directory