summaryrefslogtreecommitdiff
path: root/tools/windows_packaging/package.sh
blob: c097b73603bf5470d7e427445ef6699ccd9bdbce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/bin/bash

. ./mingw-env.sh

. ./print-env.sh

if [ -z "$DLLS" ]; then
	echo "ERROR: DLLS variable is not defined..."
	exit 1
fi

cd $BASE || exit 1

if ! test -f $BUILD_CACHE_FILE; then
	echo "ERROR: $APPNAME is not configured and built yet..."
	exit 1
fi

if [ -d $PACKAGE_DIR ]; then
	echo "Removing old package directory structure ..."
	rm -rf $PACKAGE_DIR || exit 1
fi

./waf --destdir=$PACKAGE_DIR install || exit 1

echo "Moving Ardour dll's and executable to $PACKAGE_DIR ..."

mv $PACKAGE_DIR/lib/ardour3/*.dll $PACKAGE_DIR || exit 1
mv $PACKAGE_DIR/lib/ardour3/*.exe $PACKAGE_DIR || exit 1

echo "Deleting import libs ..."

rm $PACKAGE_DIR/lib/*dll.a

# delete sh script
rm $PACKAGE_DIR/ardour3

if test x$WITH_TESTS != x ; then
	echo "Copying tests and test data to $PACKAGE_DIR ..."
	cp $BUILD_DIR/libs/pbd/run-tests.exe $PACKAGE_DIR/pbd-run-tests.exe
	cp -r $BASE/libs/pbd/test $PACKAGE_DIR/pbd_testdata

	cp $BUILD_DIR/libs/midi++2/run-tests.exe $PACKAGE_DIR/midipp-run-tests.exe

	cp $BUILD_DIR/libs/evoral/run-tests.exe $PACKAGE_DIR/evoral-run-tests.exe
	mkdir -p $PACKAGE_DIR/evoral_testdata
	cp -r $BASE/libs/evoral/test/testdata/* $PACKAGE_DIR/evoral_testdata

	cp -r $BASE/libs/ardour/test/data $PACKAGE_DIR/ardour_testdata
fi

echo "Copying config files to $PACKAGE_DIR ..."
mkdir -p $PACKAGE_DIR/etc
cp -RL $MINGW_ROOT/etc/fonts $PACKAGE_DIR/etc
cp -RL $MINGW_ROOT/etc/gtk-2.0 $PACKAGE_DIR/etc
cp -RL $MINGW_ROOT/etc/pango $PACKAGE_DIR/etc

cp -R $MINGW_ROOT/lib/gtk-2.0 $PACKAGE_DIR/lib
cp -R $MINGW_ROOT/lib/gdk-pixbuf-2.0 $PACKAGE_DIR/lib
cp $TOOLS_DIR/loaders.cache $PACKAGE_DIR/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache

mkdir -p $PACKAGE_DIR/lib/pango/1.8.0/modules
cp -r $MINGW_ROOT/lib/pango/1.8.0/modules/*.dll $PACKAGE_DIR/lib/pango/1.8.0/modules

cp $TOOLS_DIR/pango.modules $PACKAGE_DIR/etc/pango

cp $TOOLS_DIR/README $PACKAGE_DIR

echo "Copying mingw shared libraries to $PACKAGE_DIR ..."

for i in $DLLS;
do
	copydll "$i" "$PACKAGE_DIR" || exit 1
done

if test x$WITH_JACK != x; then
	echo "Copying JACK server and drivers to $PACKAGE_DIR ..."
	cp $MINGW_ROOT/bin/jackd.exe $PACKAGE_DIR
	cp -r $MINGW_ROOT/bin/jack $PACKAGE_DIR
fi

if test x$WITH_LV2 != x; then
	echo "Moving Bundled LV2 $PACKAGE_DIR ..."
	mv $PACKAGE_DIR/lib/lv2 $PACKAGE_DIR/lib/ardour3/LV2
fi

SRC_DIRS='
libs/ardour
libs/pbd
libs/gtkmm2ext
libs/midi++2
libs/evoral
libs/panners
libs/timecode
libs/audiographer
'

if [ x$DEBUG = xT ]; then

	PACKAGE_SRC_DIR=$PACKAGE_DIR/src
	echo "Copying source files to $PACKAGE_SRC_DIR ..."
	mkdir -p $PACKAGE_SRC_DIR/libs
	cp -r $BASE/gtk2_ardour $PACKAGE_SRC_DIR
	for i in $SRC_DIRS;
	do
	cp -r -p $BASE/$i $PACKAGE_SRC_DIR/libs
	done

	if test x$WITH_JACK != x; then
		echo "Copying JACK utility programs to $PACKAGE_DIR ..."
		cp $MINGW_ROOT/bin/jack_*.exe $PACKAGE_DIR
	fi

	if test x$WITH_LV2 != x; then
		echo "Copying LV2 utility programs to $PACKAGE_DIR ..."
		cp $MINGW_ROOT/bin/lilv-bench.exe $PACKAGE_DIR
		cp $MINGW_ROOT/bin/lv2info.exe $PACKAGE_DIR
		cp $MINGW_ROOT/bin/lv2ls.exe $PACKAGE_DIR
	fi

	#echo "Copying any debug files to $PACKAGE_DIR ..."
	#cp $MINGW_ROOT/bin/*.debug $PACKAGE_DIR

	echo "Copying gdb and config files to $PACKAGE_DIR ..."
	cp $MINGW_ROOT/bin/gdb.exe $PACKAGE_DIR
	cp $TOOLS_DIR/gdbinit $PACKAGE_DIR/.gdbinit
	cp $TOOLS_DIR/gdbinit_home $PACKAGE_DIR/gdbinit_home
	cp $TOOLS_DIR/gdb.bat $PACKAGE_DIR/gdb.bat
	cp $TOOLS_DIR/gdb-ardour.bat $PACKAGE_DIR/gdb-ardour.bat

	echo "Copying Gtk demo to $PACKAGE_DIR ..."
	cp $MINGW_ROOT/bin/gtk-demo.exe $PACKAGE_DIR
else
	echo "Optimized build Stripping executable ..."
	find $PACKAGE_DIR -type f -name "*.exe*" | xargs $STRIP
	echo "Stripping libraries ..."
	find $PACKAGE_DIR -type f -name "*.dll*" | xargs $STRIP
fi

if [ "$1" == "--tarball" ]; then
	echo "Creating tarball from $PACKAGE_DIR ..."
	cd $BASE || exit 1
	tar -cvJf $PACKAGE_DIR.tar.xz $PACKAGE_DIR
fi

if [ "$1" == "--zip" ]; then
	echo "Creating zip file from $PACKAGE_DIR ..."
	cd $BASE || exit 1
	zip -r $PACKAGE_DIR.zip $PACKAGE_DIR
fi