2
0

Mingw-make-dist.sh 3.4 KB

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