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 Conversion
99 find .
-name "*" |
xargs $DOS2UNIX
100 echo Completed CR
/LF to LF 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 Conversion
112 find .
-name "*.sh" |
xargs $UNIX2DOS
113 echo Completed LF to CR
/LF 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 -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
/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
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
/msvc
9/*.sln
$TEMP_DIR/generate
/msvc
9/
300 cp -r generate
/msvc
9/*.vcproj
$TEMP_DIR/generate
/msvc
9/
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
316 # %1 - Target type (win or unix)
318 #******************************************************************************
320 generate_test_package
()
323 # Parameter evaluation
325 if [ $1 == win
]; then
328 check_zip_utility_exists
330 elif [ $1 == unix
]; then
335 usage
"Invalid argument ($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
346 cp -r tests
$TEMP_DIR/tests
349 # Delete extraneous files
352 find .
-name "tmp" |
xargs rm -r -f
353 find .
-name "aml" |
xargs rm -r -f
354 find .
-name "CVS" |
xargs rm -r -f
357 if [ $PACKAGE_TYPE == Unix
]; then
359 # Unix/Linux-specific activities
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)
381 # %1 - Target type (win)
383 #******************************************************************************
385 generate_binary_package
()
388 # Parameter evaluation
390 if [ $1 == win
]; then
393 check_zip_utility_exists
396 usage
"Invalid argument ($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
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 #******************************************************************************
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)"
449 # cd from acpica/generate/release to acpica
454 # Ensure that the temporary directory is created fresh
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
471 usage
"Invalid argument ($1)"
476 # Remove temporary directory