]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - misc/buildsrc/dlls.sh
demotc-race-record-extractor.sh: remove useless rc case (gametype name is always...
[xonotic/xonotic.git] / misc / buildsrc / dlls.sh
index 98b27cd7858f79aab72797b57a462a86588adf51..1a46c419997b943ac09bb4a2cd45b6e0a8928042 100755 (executable)
@@ -4,8 +4,6 @@
 # by z411
 
 d0=$(pwd)
-cjobs=$(($(nproc) + 1))
-echo "Working directory is $d0"
 
 require () {
        if ! dpkg -s "$1" >/dev/null 2>&1 ; then
@@ -65,7 +63,7 @@ fetch_source () {
                return 1
        else
                echo "Getting source for $1..."
-               apt source "$1"
+               apt-get source -t=stable "$1"
                get_this_src "$1"
                return 0
        fi
@@ -101,21 +99,22 @@ build_zlib () {
              -DBUILD_SHARED_LIBS=ON \
              -DCMAKE_INSTALL_PREFIX="$pkg_dir" \
              -G"Unix Makefiles" "$this_src"
-       make -j${cjobs}
+       make
        make install
-}      
+}
 
 build_gmp () {
        fetch_source gmp || true
 
        mkcd "$work_dir/gmp"
+       autoreconf -i "$this_src"
        "$this_src/configure" --prefix="$pkg_dir" \
                              --host="$CHOST" \
                              --with-pic \
                              --enable-fat \
                              --disable-static \
                              --enable-shared
-       make -j${cjobs}
+       make
        make install
 }
 
@@ -136,7 +135,7 @@ build_libd0 () {
        "$src_dir/d0_blind_id/configure" --with-pic \
                                         --prefix="$pkg_dir" \
                                         --host="$CHOST"
-       make -j${cjobs}
+       make
        make install
 }
 
@@ -151,7 +150,7 @@ build_libogg() {
              -DBUILD_SHARED_LIBS=ON \
              -DCMAKE_INSTALL_PREFIX="$pkg_dir" \
              -G"Unix Makefiles" "$this_src"
-       make -j${cjobs}
+       make
        make install
 }
 
@@ -170,7 +169,7 @@ build_libvorbis () {
              -DOGG_LIBRARY="$pkg_dir/lib/libogg.dll.a" \
              -DCMAKE_INSTALL_PREFIX="$pkg_dir" \
              -G"Unix Makefiles" "$this_src"
-       make -j${cjobs}
+       make
        make install
 }
 
@@ -194,7 +193,7 @@ build_libtheora () {
                              --disable-sdltest \
                              --disable-vorbistest \
                              --disable-oggtest
-       make -j${cjobs}
+       make
        make install
 }
 
@@ -207,7 +206,7 @@ build_freetype () {
              -DCMAKE_BUILD_TYPE=Release \
              -DCMAKE_INSTALL_PREFIX="$pkg_dir" \
              -G"Unix Makefiles" "$this_src"
-       make -j${cjobs}
+       make
        make install
 }
 
@@ -222,7 +221,7 @@ build_libpng16 () {
              -DZLIB_LIBRARY="$pkg_dir/lib/libzlib.dll.a" \
              -DCMAKE_INSTALL_PREFIX="$pkg_dir" \
              -G"Unix Makefiles" "$this_src"
-       make -j${cjobs}
+       make
        make install
 }
 
@@ -237,7 +236,7 @@ build_libjpeg () {
              -DENABLE_STATIC=OFF \
              -DWITH_TURBOJPEG=OFF \
              -G"Unix Makefiles" "$this_src"
-       make -j${cjobs}
+       make
        make install
 }
 
@@ -258,7 +257,23 @@ build_curl () {
              -DBUILD_CURL_EXE=OFF \
              -DHTTP_ONLY=ON \
              -G"Unix Makefiles" "$this_src"
-       make -j${cjobs}
+       make
+       make install
+}
+
+build_libsdl2 ()
+{
+       fetch_source libsdl2 || true
+
+       # this subdir will be made available to DP's linker
+       mkdir -p "$pkg_dir/sdl"
+
+       mkcd "$work_dir/libsdl2"
+       cmake -DCMAKE_TOOLCHAIN_FILE="$toolchain_file" \
+             -DCMAKE_SYSTEM_PROCESSOR="$ARCH" \
+             -DCMAKE_INSTALL_PREFIX="$pkg_dir/sdl" \
+             -G"Unix Makefiles" "$this_src"
+       make
        make install
 }
 
@@ -273,6 +288,7 @@ build_all () {
        build_libpng16
        build_libjpeg
        build_curl
+       build_libsdl2
 }
 
 install () {
@@ -291,6 +307,12 @@ install () {
        cp -v "$pkg_dir/bin/libpng16.dll" "$out_dir"
        cp -v "$pkg_dir/bin/libjpeg-62.dll" "$out_dir/libjpeg.dll"
        cp -v "$pkg_dir/bin/libcurl.dll" "$out_dir/libcurl-4.dll"
+#      cp -v "$pkg_dir/sdl/bin/SDL2.dll" "$out_dir"
+
+       # Required for win32 builds
+       if [ "$ARCH" = "i686" ]; then
+               cp -v /usr/lib/gcc/i686-w64-mingw32/[0-9][0-9]-win32/libgcc_s_dw2-1.dll "$out_dir"
+       fi
 
        cd "$out_dir"
        ${CHOST}-strip -s *.dll
@@ -316,6 +338,7 @@ list () {
        echo libpng16
        echo libjpeg
        echo curl
+       echo libsdl2
 }
 
 usage () {
@@ -354,6 +377,7 @@ case $step in
        libpng16)      prepare && build_libpng16 ;;
        libjpeg)       prepare && build_libjpeg ;;
        curl)          prepare && build_curl ;;
+       libsdl2)       prepare && build_libsdl2 ;;
        build_all)     prepare && build_all ;;
        install)       prepare && install ;;
        all)           prepare && build_all && install ;;