1#!/bin/bash
2
3#******************************************************************************
4#
5# ACPICA release generation script for Cygwin/Windows execution
6#
7# front end for build.sh
8#
9# Copies any existing packages to the archive directory.
10#
11# Generates 3 types of package:
12#   1) Standard ACPICA source, everything except test suites
13#   2) ACPICA test suites (very large)
14#   3) Windows binary tools (Windows does not include generation tools)
15#
16# Note: "unix" generation builds the source with the standard Intel license
17# in each file header. "unix2" builds the source with the dual license instead.
18# this has been requested by some OS vendors, notably FreeBSD.
19#
20#******************************************************************************
21
22# Configuration
23
24NPARAM=$#
25BUILD_TESTS=1
26
27# Filenames and paths
28
29ARCHIVE_DIR=archive
30RELEASE_DIR=current
31
32
33#******************************************************************************
34#
35# Miscellaneous utility functions
36#
37#******************************************************************************
38
39usage()
40{
41	echo "$1"
42	echo
43	echo "Master script to create ACPICA release packages"
44	echo "Usage:"
45	echo "    $0 [notest]"
46}
47
48move_all_files_to_archive()
49{
50	cd $RELEASE_DIR
51
52	for file in *
53	do
54		if [ -d $file ]; then
55			rm -r -f ../$ARCHIVE_DIR/$file
56			mv -f $file ../$ARCHIVE_DIR
57			echo "Moved directory $file to $ARCHIVE_DIR directory"
58		else
59			cp $file ../$ARCHIVE_DIR
60			echo "Moved $file ($(ls -al $file | awk '{print $5}') bytes) to $ARCHIVE_DIR directory"
61			rm $file
62		fi
63	done
64
65	cd ..
66}
67
68
69#******************************************************************************
70#
71# main
72#
73# Arguments:
74#    $1 (optional) notest - do not generate the ACPICA test suite packages
75#
76#******************************************************************************
77
78set -e		# Abort on any error
79
80#
81# Parameter evaluation
82#
83if [ $NPARAM -gt 1 ]; then
84	usage "Wrong argument count ($NPARAM)"
85	exit 1
86
87elif [ $NPARAM -eq 1 ]; then
88	if [ $1 == notest ]; then
89		BUILD_TESTS=0
90	else
91		usage "Invalid argument ($1)"
92		exit 1
93	fi
94fi
95
96#
97# Move and preserve any previous versions of the various release packages
98#
99if [ -e $RELEASE_DIR ]; then
100
101	# Create archive directory if necessary
102
103	mkdir -p $ARCHIVE_DIR
104
105	#
106	# Save any older versions of the release packages
107	#
108	if [ "$(ls -A $RELEASE_DIR)" ]; then
109		echo "Moving previous packages to $ARCHIVE_DIR directory"
110
111		move_all_files_to_archive
112		echo "Completed move of previous packages to $ARCHIVE_DIR directory"
113	fi
114
115else
116	# Just create the release directory
117	mkdir -p $RELEASE_DIR
118fi
119
120# ACPICA source code (core subsystem and all tools/utilities)
121
122bash build.sh source win
123bash build.sh source unix
124bash build.sh source unix2
125
126# Optionally build the test suite packages (built by default)
127
128if [ $BUILD_TESTS -eq 1 ]; then
129
130	# ACPICA test suites (A unix2 build has not been requested by users)
131
132	bash build.sh test win
133	bash build.sh test unix
134
135else
136	echo "**** Test suites not built because the notest option was used"
137fi
138
139# ACPICA binary tools (Windows only)
140
141bash build.sh binary win
142
143echo
144echo "ACPICA - Summary of generated packages:"
145echo
146ls $RELEASE_DIR -g -G -t
147