Added LV2 libs and bundled LV2 plugins to windows packaging scripts
[ardour.git] / tools / windows_packaging / package.sh
1 #!/bin/bash
2
3 . ./mingw-env.sh
4
5 . ./print-env.sh
6
7 if [ -z "$DLLS" ]; then
8         echo "ERROR: DLLS variable is not defined..."
9         exit 1
10 fi
11
12 cd $BASE || exit 1
13
14 if ! test -f $BUILD_CACHE_FILE; then
15         echo "ERROR: $APPNAME is not configured and built yet..."
16         exit 1
17 fi
18
19 if [ -d $PACKAGE_DIR ]; then
20         echo "Removing old package directory structure ..."
21         rm -rf $PACKAGE_DIR || exit 1
22 fi
23
24 ./waf --destdir=$PACKAGE_DIR install || exit 1
25
26 echo "Moving Ardour dll's and executable to $PACKAGE_DIR ..."
27
28 mv $PACKAGE_DIR/lib/ardour3/*.dll $PACKAGE_DIR || exit 1
29 mv $PACKAGE_DIR/lib/ardour3/*.exe $PACKAGE_DIR || exit 1
30
31 echo "Deleting import libs ..."
32
33 rm $PACKAGE_DIR/lib/*dll.a
34
35 # delete sh script
36 rm $PACKAGE_DIR/ardour3
37
38 if test x$WITH_TESTS != x ; then
39         echo "Copying tests and test data to $PACKAGE_DIR ..."
40         cp $BUILD_DIR/libs/pbd/run-tests.exe $PACKAGE_DIR/pbd-run-tests.exe
41         cp -r $BASE/libs/pbd/test $PACKAGE_DIR/pbd_testdata
42
43         cp $BUILD_DIR/libs/evoral/run-tests.exe $PACKAGE_DIR/evoral-run-tests.exe
44         mkdir -p $PACKAGE_DIR/test/testdata
45         cp -r $BASE/libs/evoral/test/testdata/TakeFive.mid $PACKAGE_DIR/test/testdata
46
47         cp -r $BASE/libs/ardour/test/data $PACKAGE_DIR/ardour_testdata
48 fi
49
50 echo "Copying mingw config files to $PACKAGE_DIR ..."
51 # just copy it all for now
52 cp -r $MINGW_ROOT/etc $PACKAGE_DIR
53
54 cp -r $MINGW_ROOT/lib/gtk-2.0 $PACKAGE_DIR/lib
55 cp -r $MINGW_ROOT/lib/gdk-pixbuf-2.0 $PACKAGE_DIR/lib
56 cp $TOOLS_DIR/loaders.cache $PACKAGE_DIR/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
57
58 if test x$WITH_PANGO_1_6 != x; then
59         mkdir -p $PACKAGE_DIR/lib/pango/1.6.0/modules
60         cp -r $MINGW_ROOT/lib/pango/1.6.0/modules/*.dll $PACKAGE_DIR/lib/pango/1.6.0/modules
61 else
62         mkdir -p $PACKAGE_DIR/lib/pango/1.8.0/modules
63         cp -r $MINGW_ROOT/lib/pango/1.8.0/modules/*.dll $PACKAGE_DIR/lib/pango/1.8.0/modules
64 fi
65
66 cp $TOOLS_DIR/pango.modules $PACKAGE_DIR/etc/pango
67
68 cp $TOOLS_DIR/README $PACKAGE_DIR
69
70 echo "Copying mingw shared libraries to $PACKAGE_DIR ..."
71
72 for i in $DLLS;
73 do
74         copydll "$i" "$PACKAGE_DIR" || exit 1
75 done
76
77 if test x$WITH_JACK != x; then
78         echo "Copying JACK server and drivers to $PACKAGE_DIR ..."
79         cp $MINGW_ROOT/bin/jackd.exe $PACKAGE_DIR
80         cp -r $MINGW_ROOT/bin/jack $PACKAGE_DIR
81 fi
82
83 if test x$WITH_LV2 != x; then
84         echo "Moving Bundled LV2 $PACKAGE_DIR ..."
85         mv $PACKAGE_DIR/lib/lv2 $PACKAGE_DIR/lib/ardour3/LV2
86 fi
87
88 SRC_DIRS='
89 libs/ardour
90 libs/pbd
91 libs/gtkmm2ext
92 libs/midi++2
93 libs/evoral
94 libs/panners
95 libs/timecode
96 libs/audiographer
97 '
98
99 if [ x$DEBUG = xT ]; then
100
101         PACKAGE_SRC_DIR=$PACKAGE_DIR/src
102         echo "Copying source files to $PACKAGE_SRC_DIR ..."
103         mkdir -p $PACKAGE_SRC_DIR/libs
104         cp -r $BASE/gtk2_ardour $PACKAGE_SRC_DIR
105         for i in $SRC_DIRS;
106         do
107         cp -r -p $BASE/$i $PACKAGE_SRC_DIR/libs
108         done
109
110         if test x$WITH_JACK != x; then
111                 echo "Copying JACK utility programs to $PACKAGE_DIR ..."
112                 cp $MINGW_ROOT/bin/jack_*.exe $PACKAGE_DIR
113         fi
114
115         if test x$WITH_LV2 != x; then
116                 echo "Copying LV2 utility programs to $PACKAGE_DIR ..."
117                 cp $MINGW_ROOT/bin/lilv-bench.exe $PACKAGE_DIR
118                 cp $MINGW_ROOT/bin/lv2info.exe $PACKAGE_DIR
119                 cp $MINGW_ROOT/bin/lv2ls.exe $PACKAGE_DIR
120         fi
121
122         #echo "Copying any debug files to $PACKAGE_DIR ..."
123         #cp $MINGW_ROOT/bin/*.debug $PACKAGE_DIR
124
125         echo "Copying gdb and config files to $PACKAGE_DIR ..."
126         cp $MINGW_ROOT/bin/gdb.exe $PACKAGE_DIR
127         cp $TOOLS_DIR/gdbinit $PACKAGE_DIR/.gdbinit
128         cp $TOOLS_DIR/gdbinit_home $PACKAGE_DIR/gdbinit_home
129         cp $TOOLS_DIR/gdb.bat $PACKAGE_DIR/gdb.bat
130         cp $TOOLS_DIR/gdb-ardour.bat $PACKAGE_DIR/gdb-ardour.bat
131
132         echo "Copying Gtk demo to $PACKAGE_DIR ..."
133         cp $MINGW_ROOT/bin/gtk-demo.exe $PACKAGE_DIR
134 else
135         echo "Optimized build Stripping executable ..."
136         find $PACKAGE_DIR -type f -name "*.exe*" | xargs $STRIP
137         echo "Stripping libraries ..."
138         find $PACKAGE_DIR -type f -name "*.dll*" | xargs $STRIP
139 fi
140
141 if [ "$1" == "--tarball" ]; then
142         echo "Creating tarball from $PACKAGE_DIR ..."
143         cd $BASE || exit 1
144         tar -cvJf $PACKAGE_DIR.tar.xz $PACKAGE_DIR
145 fi
146
147 if [ "$1" == "--zip" ]; then
148         echo "Creating zip file from $PACKAGE_DIR ..."
149         cd $BASE || exit 1
150         zip -r $PACKAGE_DIR.zip $PACKAGE_DIR
151 fi