#!/bin/sh # A dirty script to create some windows binaries (shared, static, debug, ...) using the MSYS environment. # give build type as command line argument # x86, x86_64, x86-cross, x86_64-cross build_type=$1 if test -z "$build_type"; then echo "Please specify a build type as argument, one of:" echo "x86, x86_64, x86-cross, x86_64-cross" echo "Optionally set a number of parallel make processes as second argument." exit 1 fi build_procs=$2 # Could use parallel make with number of cores in system, # but it turns out we burn most time in configure with # slow forks anyway. #if test -z "$build_procs"; then # build_procs=$(nproc 2>/dev/null) #fi # -D__MINGW_USE_VC2005_COMPAT=1 use 64bit time internally for 32bit, so XP and earlier don't get into # missing _time32 errors echo "build type: $build_type" case $build_type in x86) decoder=x86 strip=strip hostopt="CPPFLAGS=-D__MINGW_USE_VC2005_COMPAT=1" ;; x86_64) decoder=x86-64 strip=strip hostopt= ;; x86-cross) decoder=x86 strip=i686-w64-mingw32-strip hostopt="--host=i686-w64-mingw32 --build=`./build/config.guess` CPPFLAGS=-D__MINGW_USE_VC2005_COMPAT=1" ;; x86_64-cross) decoder=x86-64 strip=x86_64-w64-mingw32-strip hostopt="--host=x86_64-w64-mingw32 --build=`./build/config.guess`" ;; *) echo "Unknown build type!" exit 1 ;; esac temp="$PWD/tmp" final="$PWD/releases" txt="README COPYING NEWS" # let's try with modules opts="LDFLAGS=-static-libgcc" #opts="--with-audio=win32 --disable-modules" # Get the version for the build from version.h. major=$(grep '#define MPG123_MAJOR' src/version.h | cut -f 3 -d ' ') minor=$(grep '#define MPG123_MINOR' src/version.h | cut -f 3 -d ' ') patch=$(grep '#define MPG123_PATCH' src/version.h | cut -f 3 -d ' ') suffix=$(grep '#define MPG123_SUFFIX' src/version.h | cut -f 2 -d '"') version="$major.$minor.$patch$suffix" echo "Building binaries for version $version" prepare_dir() { test -e "$final" || mkdir "$final" } prepare_unix2dos() { echo "preparing unix2dos tool" # I'll include documentation in DOS-style, with the help of this little unix2dos variant. test -x "unix2dos" || cat <<'EOT' > unix2dos.c && gcc -O -o unix2dos unix2dos.c #include #include int main() { char buf[1000]; ssize_t got; while((got=read(0, buf, 1000))>0) { ssize_t end=0; ssize_t pos=0; for(end=0;end $final/$name/$i.txt" ./unix2dos < "$i" > "$final/$name/$i.txt" done && cp doc/windows-notes.html "$final/$name/" } prepare_dir && prepare_unix2dos && mpg123_build $decoder y n && mpg123_build $decoder n n && mpg123_build $decoder n y && echo "Hurray!" || echo "Bleh..."