pulling trunk
[ardour.git] / libs / libsndfile / Mingw-make-dist.sh
1 #!/bin/sh
2
3 # Copyright (C) 2006 Erik de Castro Lopo <erikd@mega-nerd.com>
4 #
5 # All rights reserved.
6 #
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions are
9 # met:
10 #
11 #     * Redistributions of source code must retain the above copyright
12 #       notice, this list of conditions and the following disclaimer.
13 #     * Redistributions in binary form must reproduce the above copyright
14 #       notice, this list of conditions and the following disclaimer in
15 #       the documentation and/or other materials provided with the
16 #       distribution.
17 #     * Neither the author nor the names of any contributors may be used
18 #       to endorse or promote products derived from this software without
19 #       specific prior written permission.
20 #
21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28 # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33 set -e
34
35 if [ $# -lt 1 ] || [ $# -gt 2 ]; then
36         echo "Usage : Mingw-make-dist.sh <source tarball>."
37         exit 1
38         fi
39
40 TARGZ=$1
41 if [ ! -f $TARGZ ]; then
42         echo "Can't find source tarball."
43         fi
44
45 TARGZ=$1
46 if [ ! -f $TARGZ.asc ]; then
47         echo "Can't find source tarball signature."
48         fi
49
50 UNAME=`uname -s`
51 if [ x$UNAME != "xMINGW32_NT-5.1" ]; then
52         echo "Not able to build Win32 binaries on this platform."
53         fi
54
55 echo "Building MinGW binary/source zip file."
56
57 VERSION=`pwd | sed -e "s#.*/##" | sed -e s/libsndfile-//`
58 BUILD=`echo $VERSION | sed -e "s/\./_/g"`
59 INSTALL="libsndfile-$BUILD"
60 ZIPNAME="$INSTALL.zip"
61
62 if [ -z "$BUILD" ]; then
63         echo "Bad BUILD variable : '$BUILD'"
64         exit 1
65         fi
66
67 if [ ! -d $INSTALL/ ];  then
68         mkdir $INSTALL
69         fi
70
71 if [ ! -f config.status ]; then
72         ./configure --prefix=`pwd`/$INSTALL/
73 else
74         teststr=`grep "with options" config.status | grep -- --prefix=`
75         if [ -z "$teststr" ]; then
76                 # --disable-static doesn't work.
77                 ./configure --prefix=`pwd`/$INSTALL/
78                 fi
79         fi
80
81 if [ ! -f src/.libs/libsndfile-1.dll ]; then
82         make all check
83         fi
84
85 if [ ! -f $INSTALL/bin/libsndfile-1.dll ]; then
86         make install
87         rm -f $INSTALL/bin/sndfile-regtest.exe
88         strip $INSTALL/bin/*.*
89         mv $INSTALL/bin/*.* $INSTALL/include/*.* $INSTALL/
90         rmdir $INSTALL/bin
91         rm -rf $INSTALL/lib
92         rmdir $INSTALL/include
93         cp src/libsndfile.def $INSTALL/
94         cp Win32/README-precompiled-dll.txt $INSTALL/
95         fi
96
97 if [ ! -f $INSTALL/libsndfile-$VERSION.tar.gz ]; then
98         cp $TARGZ $INSTALL/
99         if [ -f $TARGZ.asc ]; then
100                 cp $TARGZ.asc $INSTALL/
101                 fi
102         fi
103
104 if [ ! -f $ZIPNAME ]; then
105         zip -r $ZIPNAME $INSTALL/
106         fi
107
108
109 # Do not edit or modify anything in this comment block.
110 # The following line is a file identity tag for the GNU Arch
111 # revision control system.
112 #
113 # arch-tag: 3f82cd8a-f800-48d7-9646-2cdcf03c81a0