diff --git a/libretro-build-win32.sh b/libretro-build-win32.sh index cb2fb087..f6f7bb10 100755 --- a/libretro-build-win32.sh +++ b/libretro-build-win32.sh @@ -1,10 +1,13 @@ #!/bin/sh -SCRIPT=$(readlink -f $0) -BASE_DIR=$(dirname $SCRIPT) -RARCH_DIR=$BASE_DIR/dist -RARCH_DIST_DIR=$RARCH_DIR/windows -JOBS=4 +SCRIPT=$(readlink -f "$0") +BASE_DIR=$(dirname "$SCRIPT") +RARCH_DIR="$BASE_DIR/dist" +RARCH_DIST_DIR="$RARCH_DIR/windows" + +if [ -z "$JOBS" ]; then + JOBS=4 +fi die() { diff --git a/libretro-build.sh b/libretro-build.sh index 1bb40bcb..4771a37e 100755 --- a/libretro-build.sh +++ b/libretro-build.sh @@ -1,10 +1,26 @@ #!/bin/sh -SCRIPT=$(readlink -f $0) -BASE_DIR=$(dirname $SCRIPT) -RARCH_DIR=$BASE_DIR/dist -RARCH_DIST_DIR=$RARCH_DIR/pc -JOBS=4 +UNAME=$(uname) +if [ "`echo $UNAME | grep Linux`" ]; then + EXE="so" +elif [ "`echo $UNAME | grep BSD`" ]; then + EXE="so" +elif [ "`echo $UNAME | grep Darwin`" ]; then + EXE="dylib" +elif [ "`echo $UNAME | grep -i MINGW`" ]; then + EXE="dll" +else + EXE="so" +fi + +SCRIPT=$(readlink -f "$0") +BASE_DIR=$(dirname "$SCRIPT") +RARCH_DIR=""$BASE_DIR"/dist" +RARCH_DIST_DIR="$RARCH_DIR/pc" + +if [ -z "$JOBS" ]; then + JOBS=4 +fi die() { @@ -12,7 +28,7 @@ die() #exit 1 } -ARCH=`uname -m` +ARCH=$(uname -m) X86=false X86_64=false ARM=false @@ -46,41 +62,41 @@ build_libretro_bsnes() CC=gcc fi - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-bsnes/perf" ]; then echo "=== Building bSNES performance ===" cd libretro-bsnes/perf/higan make compiler="$CC" ui=target-libretro profile=performance -j$JOBS clean || die "Failed to clean bSNES performance core" make compiler="$CC" ui=target-libretro profile=performance -j$JOBS || die "Failed to build bSNES performance core" - cp -f out/libretro.so "$RARCH_DIST_DIR"/libretro-bsnes-performance.so + cp -f out/libretro.${EXE} "$RARCH_DIST_DIR"/libretro-bsnes-performance.${EXE} else echo "bSNES performance not fetched, skipping ..." fi - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-bsnes/balanced" ]; then echo "=== Building bSNES balanced ===" cd libretro-bsnes/balanced/higan make compiler="$CC" ui=target-libretro profile=balanced -j$JOBS clean || die "Failed to clean bSNES balanced core" make compiler="$CC" ui=target-libretro profile=balanced -j$JOBS || die "Failed to build bSNES balanced core" - cp -f out/libretro.so "$RARCH_DIST_DIR"/libretro-bsnes-balanced.so + cp -f out/libretro.${EXE} "$RARCH_DIST_DIR"/libretro-bsnes-balanced.${EXE} else echo "bSNES compat not fetched, skipping ..." fi - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-bsnes" ]; then echo "=== Building bSNES accuracy ===" cd libretro-bsnes/higan make compiler="$CC" ui=target-libretro profile=accuracy -j$JOBS clean || die "Failed to clean bSNES accuracy core" make compiler="$CC" ui=target-libretro profile=accuracy -j$JOBS || die "Failed to build bSNES accuracy core" - cp -f out/libretro.so "$RARCH_DIST_DIR"/libretro-bsnes-accuracy.so + cp -f out/libretro.${EXE} "$RARCH_DIST_DIR"/libretro-bsnes-accuracy.${EXE} fi } build_libretro_mednafen() { - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-mednafen" ]; then echo "=== Building Mednafen ===" cd libretro-mednafen @@ -89,7 +105,7 @@ build_libretro_mednafen() do make core=${core} -j$JOBS clean || die "Failed to clean mednafen/${core}" make core=${core} -j$JOBS || die "Failed to build mednafen/${core}" - cp mednafen_$(echo ${core} | tr '[\-]' '[_]')_libretro.so "$RARCH_DIST_DIR"/libretro-mednafen-${core}.so + cp mednafen_$(echo ${core} | tr '[\-]' '[_]')_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-mednafen-${core}.${EXE} done else echo "Mednafen not fetched, skipping ..." @@ -113,13 +129,13 @@ build_libretro_mame078() build_libretro_s9x() { - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-s9x" ]; then echo "=== Building SNES9x ===" cd libretro-s9x/libretro make -j$JOBS clean || die "Failed to clean SNES9x" make -j$JOBS || die "Failed to build SNES9x" - cp libretro.so "$RARCH_DIST_DIR"/libretro-snes9x.so + cp libretro.${EXE} "$RARCH_DIST_DIR"/libretro-snes9x.${EXE} else echo "SNES9x not fetched, skipping ..." fi @@ -127,13 +143,13 @@ build_libretro_s9x() build_libretro_s9x_next() { - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-s9x-next" ]; then echo "=== Building SNES9x-Next ===" cd libretro-s9x-next/ make -f Makefile.libretro -j$JOBS clean || die "Failed to clean SNES9x-Next" make -f Makefile.libretro -j$JOBS || die "Failed to build SNES9x-Next" - cp snes9x_next_libretro.so "$RARCH_DIST_DIR"/libretro-snes9x-next.so + cp snes9x_next_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-snes9x-next.${EXE} else echo "SNES9x-Next not fetched, skipping ..." fi @@ -141,13 +157,13 @@ build_libretro_s9x_next() build_libretro_genplus() { - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-genplus" ]; then echo "=== Building Genplus GX ===" cd libretro-genplus/ make -f Makefile.libretro -j$JOBS clean || die "Failed to clean Genplus GX" make -f Makefile.libretro -j$JOBS || die "Failed to build Genplus GX" - cp genesis_plus_gx_libretro.so "$RARCH_DIST_DIR"/libretro-genplus.so + cp genesis_plus_gx_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-genplus.${EXE} else echo "Genplus GX not fetched, skipping ..." fi @@ -155,14 +171,14 @@ build_libretro_genplus() build_libretro_fba() { - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-fba" ]; then echo "=== Building Final Burn Alpha ===" cd libretro-fba/ cd svn-current/trunk make -f makefile.libretro clean || die "Failed to clean Final Burn Alpha" make -f makefile.libretro -j$JOBS || die "Failed to build Final Burn Alpha" - cp fb_alpha_libretro.so "$RARCH_DIST_DIR"/libretro-fba.so + cp fb_alpha_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-fba.${EXE} else echo "Final Burn Alpha not fetched, skipping ..." fi @@ -170,13 +186,13 @@ build_libretro_fba() build_libretro_vba() { - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-vba" ]; then echo "=== Building VBA-Next ===" cd libretro-vba/ make -f Makefile.libretro -j$JOBS clean || die "Failed to clean VBA-Next" make -f Makefile.libretro -j$JOBS || die "Failed to build VBA-Next" - cp vba_next_libretro.so "$RARCH_DIST_DIR"/libretro-vba.so + cp vba_next_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-vba.${EXE} else echo "VBA-Next not fetched, skipping ..." fi @@ -184,14 +200,14 @@ build_libretro_vba() build_libretro_bnes() { - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-bnes" ]; then echo "=== Building bNES ===" cd libretro-bnes mkdir -p obj make -j$JOBS clean || die "Failed to clean bNES" make -j$JOBS || die "Failed to build bNES" - cp libretro.so "$RARCH_DIST_DIR"/libretro-bnes.so + cp libretro.${EXE} "$RARCH_DIST_DIR"/libretro-bnes.${EXE} else echo "bNES not fetched, skipping ..." fi @@ -199,13 +215,13 @@ build_libretro_bnes() build_libretro_fceu() { - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-fceu" ]; then echo "=== Building FCEU ===" cd libretro-fceu make -C fceumm-code -f Makefile.libretro -j$JOBS clean || die "Failed to clean FCEU" make -C fceumm-code -f Makefile.libretro -j$JOBS || die "Failed to build FCEU" - cp fceumm-code/fceumm_libretro.so "$RARCH_DIST_DIR"/libretro-fceu.so + cp fceumm-code/fceumm_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-fceu.${EXE} else echo "FCEU not fetched, skipping ..." fi @@ -213,13 +229,13 @@ build_libretro_fceu() build_libretro_gambatte() { - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-gambatte" ]; then echo "=== Building Gambatte ===" cd libretro-gambatte/libgambatte make -f Makefile.libretro -j$JOBS clean || die "Failed to clean Gambatte" make -f Makefile.libretro -j$JOBS || die "Failed to build Gambatte" - cp gambatte_libretro.so "$RARCH_DIST_DIR"/libretro-gambatte.so + cp gambatte_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-gambatte.${EXE} else echo "Gambatte not fetched, skipping ..." fi @@ -227,26 +243,26 @@ build_libretro_gambatte() build_libretro_meteor() { - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-meteor" ]; then echo "=== Building Meteor ===" cd libretro-meteor/libretro make -j$JOBS clean || die "Failed to clean Meteor" make -j$JOBS || die "Failed to build Meteor" - cp libretro.so "$RARCH_DIST_DIR"/libretro-meteor.so + cp libretro.${EXE} "$RARCH_DIST_DIR"/libretro-meteor.${EXE} else echo "Meteor not fetched, skipping ..." fi } build_libretro_nx() { - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-nx" ]; then echo "=== Building NXEngine ===" cd libretro-nx make -j$JOBS clean || die "Failed to clean NXEngine" make -j$JOBS || die "Failed to build NXEngine" - cp nxengine_libretro.so "$RARCH_DIST_DIR"/libretro-nx.so + cp nxengine_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-nx.${EXE} else echo "NXEngine not fetched, skipping ..." fi @@ -254,13 +270,13 @@ build_libretro_nx() build_libretro_prboom() { - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-prboom" ]; then echo "=== Building PRBoom ===" cd libretro-prboom make -j$JOBS clean || die "Failed to clean PRBoom" make -j$JOBS || die "Failed to build PRBoom" - cp prboom_libretro.so "$RARCH_DIST_DIR"/libretro-prboom.so + cp prboom_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-prboom.${EXE} else echo "PRBoom not fetched, skipping ..." fi @@ -268,13 +284,13 @@ build_libretro_prboom() build_libretro_stella() { - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-stella" ]; then echo "=== Building Stella ===" cd libretro-stella make -j$JOBS clean || die "Failed to clean Stella" make -j$JOBS || die "Failed to build Stella" - cp libretro.so "$RARCH_DIST_DIR"/libretro-stella.so + cp libretro.${EXE} "$RARCH_DIST_DIR"/libretro-stella.${EXE} else echo "Stella not fetched, skipping ..." fi @@ -282,7 +298,7 @@ build_libretro_stella() build_libretro_desmume() { - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-desmume" ]; then echo "=== Building Desmume ===" cd libretro-desmume @@ -298,7 +314,7 @@ build_libretro_desmume() make -f Makefile.libretro -j$JOBS clean || die "Failed to clean Desmume" make -f Makefile.libretro -j$JOBS || die "Failed to build Desmume" fi - cp desmume_libretro.so "$RARCH_DIST_DIR"/libretro-desmume.so + cp desmume_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-desmume.${EXE} else echo "Desmume not fetched, skipping ..." fi @@ -327,13 +343,13 @@ build_libretro_pcsx_rearmed() build_libretro_quicknes() { - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-quicknes" ]; then echo "=== Building QuickNES ===" cd libretro-quicknes/libretro make -j$JOBS clean || die "Failed to clean QuickNES" make -j$JOBS || die "Failed to build QuickNES" - cp libretro.so "$RARCH_DIST_DIR"/libretro-quicknes.so + cp libretro.${EXE} "$RARCH_DIST_DIR"/libretro-quicknes.${EXE} else echo "QuickNES not fetched, skipping ..." fi @@ -341,13 +357,13 @@ build_libretro_quicknes() build_libretro_nestopia() { - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-nestopia" ]; then echo "=== Building Nestopia ===" cd libretro-nestopia/libretro make -j$JOBS clean || die "Failed to clean Nestopia" make -j$JOBS || die "Failed to build Nestopia" - cp nestopia_libretro.so "$RARCH_DIST_DIR"/libretro-nestopia.so + cp nestopia_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-nestopia.${EXE} else echo "Nestopia not fetched, skipping ..." fi @@ -355,13 +371,13 @@ build_libretro_nestopia() build_libretro_tyrquake() { - cd $BASE_DIR + cd "$BASE_DIR" if [ -d "libretro-tyrquake" ]; then echo "=== Building Tyr Quake ===" cd libretro-tyrquake make -f Makefile.libretro -j$JOBS clean || die "Failed to clean Tyr Quake" make -f Makefile.libretro -j$JOBS || die "Failed to build Tyr Quake" - cp tyrquake_libretro.so "$RARCH_DIST_DIR"/libretro-tyrquake.so + cp tyrquake_libretro.${EXE} "$RARCH_DIST_DIR"/libretro-tyrquake.${EXE} else echo "Tyr Quake not fetched, skipping ..." fi