Only copy necessary config files to package directory
[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 config files to $PACKAGE_DIR ..."
51 mkdir -p $PACKAGE_DIR/etc
52 cp -RL $MINGW_ROOT/etc/fonts $PACKAGE_DIR/etc
53 cp -RL $MINGW_ROOT/etc/gtk-2.0 $PACKAGE_DIR/etc
54 cp -RL $MINGW_ROOT/etc/pango $PACKAGE_DIR/etc
55
56 cp -R $MINGW_ROOT/lib/gtk-2.0 $PACKAGE_DIR/lib
57 cp -R $MINGW_ROOT/lib/gdk-pixbuf-2.0 $PACKAGE_DIR/lib
58 cp $TOOLS_DIR/loaders.cache $PACKAGE_DIR/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
59
60 if test x$WITH_PANGO_1_6 != x; then
61         mkdir -p $PACKAGE_DIR/lib/pango/1.6.0/modules
62         cp -r $MINGW_ROOT/lib/pango/1.6.0/modules/*.dll $PACKAGE_DIR/lib/pango/1.6.0/modules
63 else
64         mkdir -p $PACKAGE_DIR/lib/pango/1.8.0/modules
65         cp -r $MINGW_ROOT/lib/pango/1.8.0/modules/*.dll $PACKAGE_DIR/lib/pango/1.8.0/modules
66 fi
67
68 cp $TOOLS_DIR/pango.modules $PACKAGE_DIR/etc/pango
69
70 cp $TOOLS_DIR/README $PACKAGE_DIR
71
72 echo "Copying mingw shared libraries to $PACKAGE_DIR ..."
73
74 for i in $DLLS;
75 do
76         copydll "$i" "$PACKAGE_DIR" || exit 1
77 done
78
79 if test x$WITH_JACK != x; then
80         echo "Copying JACK server and drivers to $PACKAGE_DIR ..."
81         cp $MINGW_ROOT/bin/jackd.exe $PACKAGE_DIR
82         cp -r $MINGW_ROOT/bin/jack $PACKAGE_DIR
83 fi
84
85 if test x$WITH_LV2 != x; then
86         echo "Moving Bundled LV2 $PACKAGE_DIR ..."
87         mv $PACKAGE_DIR/lib/lv2 $PACKAGE_DIR/lib/ardour3/LV2
88 fi
89
90 SRC_DIRS='
91 libs/ardour
92 libs/pbd
93 libs/gtkmm2ext
94 libs/midi++2
95 libs/evoral
96 libs/panners
97 libs/timecode
98 libs/audiographer
99 '
100
101 if [ x$DEBUG = xT ]; then
102
103         PACKAGE_SRC_DIR=$PACKAGE_DIR/src
104         echo "Copying source files to $PACKAGE_SRC_DIR ..."
105         mkdir -p $PACKAGE_SRC_DIR/libs
106         cp -r $BASE/gtk2_ardour $PACKAGE_SRC_DIR
107         for i in $SRC_DIRS;
108         do
109         cp -r -p $BASE/$i $PACKAGE_SRC_DIR/libs
110         done
111
112         if test x$WITH_JACK != x; then
113                 echo "Copying JACK utility programs to $PACKAGE_DIR ..."
114                 cp $MINGW_ROOT/bin/jack_*.exe $PACKAGE_DIR
115         fi
116
117         if test x$WITH_LV2 != x; then
118                 echo "Copying LV2 utility programs to $PACKAGE_DIR ..."
119                 cp $MINGW_ROOT/bin/lilv-bench.exe $PACKAGE_DIR
120                 cp $MINGW_ROOT/bin/lv2info.exe $PACKAGE_DIR
121                 cp $MINGW_ROOT/bin/lv2ls.exe $PACKAGE_DIR
122         fi
123
124         #echo "Copying any debug files to $PACKAGE_DIR ..."
125         #cp $MINGW_ROOT/bin/*.debug $PACKAGE_DIR
126
127         echo "Copying gdb and config files to $PACKAGE_DIR ..."
128         cp $MINGW_ROOT/bin/gdb.exe $PACKAGE_DIR
129         cp $TOOLS_DIR/gdbinit $PACKAGE_DIR/.gdbinit
130         cp $TOOLS_DIR/gdbinit_home $PACKAGE_DIR/gdbinit_home
131         cp $TOOLS_DIR/gdb.bat $PACKAGE_DIR/gdb.bat
132         cp $TOOLS_DIR/gdb-ardour.bat $PACKAGE_DIR/gdb-ardour.bat
133
134         echo "Copying Gtk demo to $PACKAGE_DIR ..."
135         cp $MINGW_ROOT/bin/gtk-demo.exe $PACKAGE_DIR
136 else
137         echo "Optimized build Stripping executable ..."
138         find $PACKAGE_DIR -type f -name "*.exe*" | xargs $STRIP
139         echo "Stripping libraries ..."
140         find $PACKAGE_DIR -type f -name "*.dll*" | xargs $STRIP
141 fi
142
143 if [ "$1" == "--tarball" ]; then
144         echo "Creating tarball from $PACKAGE_DIR ..."
145         cd $BASE || exit 1
146         tar -cvJf $PACKAGE_DIR.tar.xz $PACKAGE_DIR
147 fi
148
149 if [ "$1" == "--zip" ]; then
150         echo "Creating zip file from $PACKAGE_DIR ..."
151         cd $BASE || exit 1
152         zip -r $PACKAGE_DIR.zip $PACKAGE_DIR
153 fi