build-cmd.sh 4.18 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/bin/bash

cd "$(dirname "$0")"

# turn on verbose debugging output for parabuild logs.
set -x
# make errors fatal
set -e

if [ -z "$AUTOBUILD" ] ; then 
    fail
fi

if [ "$OSTYPE" = "cygwin" ] ; then
    export AUTOBUILD="$(cygpath -u $AUTOBUILD)"
fi

18
OGG_VERSION=1.2.2
19
OGG_SOURCE_DIR="libogg-$OGG_VERSION"
20
VORBIS_VERSION=1.3.2
Alain Linden's avatar
Alain Linden committed
21
VORBIS_SOURCE_DIR=libvorbis-$VORBIS_VERSION
22 23 24 25 26 27 28

# load autbuild provided shell functions and variables
eval "$("$AUTOBUILD" source_environment)"

top="$(pwd)"
stage="$(pwd)/stage"

29 30 31 32

build=${AUTOBUILD_BUILD_ID:=0}
echo "${OGG_VERSION}-${VORBIS_VERSION}.${build}" > "${stage}/VERSION.txt"

Alain Linden's avatar
Alain Linden committed
33 34 35
case "$AUTOBUILD_PLATFORM" in
    "windows")
        pushd "$OGG_SOURCE_DIR"
36

Alain Linden's avatar
Alain Linden committed
37
        packages="$(cygpath -m "$stage/packages")"
38

Alain Linden's avatar
Alain Linden committed
39 40
        build_sln "win32/ogg.sln" "Debug|Win32" "ogg_static"
        build_sln "win32/ogg.sln" "Release|Win32" "ogg_static"
41

Alain Linden's avatar
Alain Linden committed
42 43 44 45 46
        mkdir -p "$stage/lib"/{debug,release}
        cp "win32/Static_Debug/ogg_static_d.lib" "$stage/lib/debug/ogg_static_d.lib"
        cp "win32/Static_Debug/vc100.pdb" "$stage/lib/debug/ogg_static_d.pdb"
        cp "win32/Static_Release/ogg_static.lib" "$stage/lib/release/ogg_static.lib"
        cp "win32/Static_Release/vc100.pdb" "$stage/lib/release/ogg_static.pdb"
47

Alain Linden's avatar
Alain Linden committed
48 49 50 51 52 53 54 55
        mkdir -p "$stage/include"
        cp -a "include/ogg/" "$stage/include/"
        
        popd
        pushd "$VORBIS_SOURCE_DIR"
        
        build_sln "win32/vorbis.sln" "Debug|Win32" "vorbis_static"
        build_sln "win32/vorbis.sln" "Release|Win32" "vorbis_static"
56 57 58 59
        build_sln "win32/vorbis.sln" "Debug|Win32" "vorbisenc_static"
        build_sln "win32/vorbis.sln" "Release|Win32" "vorbisenc_static"
        build_sln "win32/vorbis.sln" "Debug|Win32" "vorbisfile_static"
        build_sln "win32/vorbis.sln" "Release|Win32" "vorbisfile_static"
Alain Linden's avatar
Alain Linden committed
60
        
61 62
        cp "win32/Vorbis_Static_Debug/vorbis_static_d.lib" "$stage/lib/debug/vorbis_static_d.lib"
        cp "win32/Vorbis_Static_Debug/vc100.pdb" "$stage/lib/debug/vorbis_static_d.pdb"
Alain Linden's avatar
Alain Linden committed
63 64
        cp "win32/Vorbis_Static_Release/vorbis_static.lib" "$stage/lib/release/vorbis_static.lib"
        cp "win32/Vorbis_Static_Release/vc100.pdb" "$stage/lib/release/vorbis_static.pdb"
65 66 67 68 69 70 71 72
        cp "win32/VorbisEnc_Static_Debug/vorbisenc_static_d.lib" "$stage/lib/debug/vorbisenc_static_d.lib"
        cp "win32/VorbisEnc_Static_Debug/vc100.pdb" "$stage/lib/debug/vorbisenc_static_d.pdb"
        cp "win32/VorbisEnc_Static_Release/vorbisenc_static.lib" "$stage/lib/release/vorbisenc_static.lib"
        cp "win32/VorbisEnc_Static_Release/vc100.pdb" "$stage/lib/release/vorbis_static.pdb"
        cp "win32/VorbisFile_Static_Debug/vorbisfile_static_d.lib" "$stage/lib/debug/vorbisfile_static_d.lib"
        cp "win32/VorbisFile_Static_Debug/vc100.pdb" "$stage/lib/debug/vorbis_static_d.pdb"
        cp "win32/VorbisFile_Static_Release/vorbisfile_static.lib" "$stage/lib/release/vorbisfile_static.lib"
        cp "win32/VorbisFile_Static_Release/vc100.pdb" "$stage/lib/release/vorbis_static.pdb"
Alain Linden's avatar
Alain Linden committed
73 74 75 76
        cp -a "include/vorbis/" "$stage/include/"
        popd
    ;;
    "darwin")
Andrew A. de Laix's avatar
Andrew A. de Laix committed
77
        pushd "$OGG_SOURCE_DIR"
78 79 80 81
        opts="-arch i386 -iwithsysroot /Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.7"
        export CFLAGS="$opts" 
        export CPPFLAGS="$opts" 
        export LDFLAGS="$opts"
Andrew A. de Laix's avatar
Andrew A. de Laix committed
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
        ./configure --prefix="$stage"
        make
        make install
        popd
        
        pushd "$VORBIS_SOURCE_DIR"
        ./configure --prefix="$stage"
        make
        make install
        popd
        
        mv "$stage/lib" "$stage/release"
        mkdir -p "$stage/lib"
        mv "$stage/release" "$stage/lib"
     ;;
Alain Linden's avatar
Alain Linden committed
97
    "linux")
Andrew de Laix's avatar
Andrew de Laix committed
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
        pushd "$OGG_SOURCE_DIR"
        CFLAGS="-m32" CXXFLAGS="-m32" ./configure --prefix="$stage"
        make
        make install
        popd
        
        pushd "$VORBIS_SOURCE_DIR"
        export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$stage/lib"
        CFLAGS="-m32" CXXFLAGS="-m32" ./configure --prefix="$stage"
        make
        make install
        popd
        
        mv "$stage/lib" "$stage/release"
        mkdir -p "$stage/lib"
        mv "$stage/release" "$stage/lib"
Alain Linden's avatar
Alain Linden committed
114 115 116 117
    ;;
esac
mkdir -p "$stage/LICENSES"
pushd "$OGG_SOURCE_DIR"
118 119 120 121 122
    cp COPYING "$stage/LICENSES/ogg-vorbis.txt"
popd

pass