Guest User

libretro-build-mingw-w64.sh

a guest
May 9th, 2013
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 10.55 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. #SCRIPT=$(readlink -f "$0")
  4. #BASE_DIR=$(dirname "$SCRIPT")
  5. #RARCH_DIR="$BASE_DIR/dist"
  6. RARCH_DIST_DIR="C:\MinGW-w64\MinGW\libretro-super\dist\windows"
  7.  
  8. if [ -z "$JOBS" ]; then
  9.    JOBS=4
  10. fi
  11.  
  12. die()
  13. {
  14.    echo $1
  15.    #exit 1
  16. }
  17.  
  18. if [ "$HOST_CC" ]; then
  19.    CC="${HOST_CC}-gcc"
  20.    CXX="${HOST_CC}-g++"
  21.    STRIP="${HOST_CC}-strip"
  22. fi
  23.  
  24. if [ -z "$MAKE" ]; then
  25.    if [ "$(expr substr $(uname -s) 1 7)" == "MINGW32" ]; then
  26.       MAKE=mingw32-make
  27.    else
  28.       MAKE=make
  29.    fi
  30. fi
  31.  
  32. if [ -z "$CC" ]; then
  33.    if [ "$(expr substr $(uname -s) 1 7)" == "MINGW32" ]; then
  34.       CC=mingw32-gcc
  35.    else
  36.       CC=gcc
  37.    fi
  38. fi
  39.  
  40. if [ -z "$CXX" ]; then
  41.    if [ "$(expr substr $(uname -s) 1 7)" == "MINGW32" ]; then
  42.       CXX=mingw32-g++
  43.    else
  44.       CXX=g++
  45.    fi
  46. fi
  47.  
  48. MAKE=make
  49. CC=gcc
  50. CXX=g++
  51.  
  52. build_libretro_bsnes()
  53. {
  54.    if [ -d "libretro-bsnes/perf" ]; then
  55.       echo "=== Building bSNES performance ==="
  56.       cd libretro-bsnes/perf/higan
  57.       rm -f obj/*.o
  58.       rm -f out/*.dll
  59.       $MAKE platform=win compiler="$CC" ui=target-libretro profile=performance -j$JOBS clean || die "Failed to clean bSNES performance core"
  60.       $MAKE platform=win compiler="$CC" ui=target-libretro profile=performance -j$JOBS || die "Failed to build bSNES performance core"
  61.       cp -f out/retro.dll "$RARCH_DIST_DIR"/libretro-092-bsnes-performance.dll
  62.       cd ../../..
  63.    else
  64.       echo "bSNES performance not fetched, skipping ..."
  65.    fi
  66.  
  67.    if [ -d "libretro-bsnes/balanced" ]; then
  68.       echo "=== Building bSNES balanced ==="
  69.       cd libretro-bsnes/balanced/higan
  70.       rm -f obj/*.o
  71.       rm -f out/*.dll
  72.       $MAKE platform=win compiler="$CC" ui=target-libretro profile=balanced -j$JOBS clean || die "Failed to clean bSNES balanced core"
  73.       $MAKE platform=win compiler="$CC" ui=target-libretro profile=balanced -j$JOBS || die "Failed to build bSNES balanced core"
  74.       cp -f out/retro.dll "$RARCH_DIST_DIR"/libretro-092-bsnes-balanced.dll
  75.       cd ../../..
  76.    else
  77.       echo "bSNES compat not fetched, skipping ..."
  78.    fi
  79.  
  80.    if [ -d "libretro-bsnes" ]; then
  81.       echo "=== Building bSNES accuracy ==="
  82.       cd libretro-bsnes/higan
  83.       rm -f obj/*.o
  84.       rm -f out/*.dll
  85.       $MAKE platform=win compiler="$CC" ui=target-libretro profile=accuracy -j$JOBS clean || die "Failed to clean bSNES accuracy core"
  86.       $MAKE platform=win compiler="$CC" ui=target-libretro profile=accuracy -j$JOBS || die "Failed to build bSNES accuracy core"
  87.       cp -f out/retro.dll "$RARCH_DIST_DIR"/libretro-092-bsnes-accuracy.dll
  88.       cd ../..
  89.    fi
  90. }
  91.  
  92. build_libretro_mednafen()
  93. {
  94.    if [ -d "libretro-mednafen" ]; then
  95.       echo "=== Building Mednafen ==="
  96.       cd libretro-mednafen
  97.  
  98.       cd psx
  99.       $MAKE core=psx platform=win CC=$CC CXX=$CXX -j$JOBS clean || die "Failed to clean mednafen/psx"
  100.       $MAKE core=psx platform=win CC=$CC CXX=$CXX -j$JOBS || die "Failed to build mednafen/psx"
  101.       cp retro.dll "$RARCH_DIST_DIR"/libretro-0928-mednafen-psx.dll
  102.       "$STRIP" ../libretro-0928-mednafen-psx.dll
  103.       cd ..
  104.  
  105.       cd pce-fast
  106.       $MAKE core=pce-fast platform=win CC=$CC CXX=$CXX -j$JOBS clean || die "Failed to clean mednafen/pce-fast"
  107.       $MAKE core=pce-fast platform=win CC=$CC CXX=$CXX -j$JOBS || die "Failed to build mednafen/pce-fast"
  108.       cp retro.dll "$RARCH_DIST_DIR"/libretro-0928-mednafen-pce-fast.dll
  109.       "$STRIP" "$RARCH_DIST_DIR"/libretro-0928-mednafen-pce-fast.dll
  110.       cd ..
  111.  
  112.       cd wswan
  113.       $MAKE core=wswan platform=win CC=$CC CXX=$CXX -j$JOBS clean || die "Failed to clean mednafen/wswan"
  114.       $MAKE core=wswan platform=win CC=$CC CXX=$CXX -j$JOBS || die "Failed to build mednafen/wswan"
  115.       cp retro.dll "$RARCH_DIST_DIR"/libretro-0928-mednafen-wswan.dll
  116.       "$STRIP" "$RARCH_DIST_DIR"/libretro-0928-mednafen-wswan.dll
  117.       cd ..
  118.  
  119.       cd ..
  120.    else
  121.       echo "Mednafen not fetched, skipping ..."
  122.    fi
  123. }
  124.  
  125. build_libretro_s9x()
  126. {
  127.    if [ -d "libretro-s9x" ]; then
  128.       echo "=== Building SNES9x ==="
  129.       cd libretro-s9x/libretro
  130.       $MAKE CC=$CC CXX=$CXX platform=win -j$JOBS clean || die "Failed to clean SNES9x"
  131.       $MAKE CC=$CC CXX=$CXX platform=win -j$JOBS || die "Failed to build SNES9x"
  132.       cp libretro.dll "$RARCH_DIST_DIR"/libretro-git-snes9x.dll
  133.       cd ../..
  134.    else
  135.       echo "SNES9x not fetched, skipping ..."
  136.    fi
  137. }
  138.  
  139. build_libretro_s9x_next()
  140. {
  141.    if [ -d "libretro-s9x-next" ]; then
  142.       echo "=== Building SNES9x-Next ==="
  143.       cd libretro-s9x-next/
  144.       $MAKE CC=$CC CXX=$CXX platform=win -f Makefile.libretro -j$JOBS clean || die "Failed to clean SNES9x-Next"
  145.       $MAKE CC=$CC CXX=$CXX platform=win -f Makefile.libretro -j$JOBS || die "Failed to build SNES9x-Next"
  146.       cp snes9x_next_retro.dll "$RARCH_DIST_DIR"/libretro-git-snes9x-next.dll
  147.       cd ..
  148.    else
  149.       echo "SNES9x-Next not fetched, skipping ..."
  150.    fi
  151. }
  152.  
  153. build_libretro_genplus()
  154. {
  155.    if [ -d "libretro-genplus" ]; then
  156.       echo "=== Building Genplus GX ==="
  157.       cd libretro-genplus/
  158.       $MAKE CC=$CC CXX=$CXX platform=win -f Makefile.libretro -j$JOBS clean || die "Failed to clean Genplus GX"
  159.       $MAKE CC=$CC CXX=$CXX platform=win -f Makefile.libretro -j$JOBS || die "Failed to build Genplus GX"
  160.       cp genesis_plus_gx_retro.dll "$RARCH_DIST_DIR"/libretro-git-genplus.dll
  161.       cd ..
  162.    else
  163.       echo "Genplus GX not fetched, skipping ..."
  164.    fi
  165. }
  166.  
  167. build_libretro_fba()
  168. {
  169.    if [ -d "libretro-fba" ]; then
  170.       echo "=== Building Final Burn Alpha ==="
  171.       cd libretro-fba/svn-current/trunk
  172.       $MAKE CC=$CC CXX=$CXX platform=win -f makefile.libretro -j$JOBS clean || die "Failed to clean Final Burn Alpha"
  173.       $MAKE CC=$CC CXX=$CXX platform=win -f makefile.libretro -j$JOBS || die "Failed to build Final Burn Alpha"
  174.       cp fb_alpha_retro.dll "$RARCH_DIST_DIR"/libretro-git-fba.dll
  175.       cd ../../..
  176.    else
  177.       echo "Final Burn Alpha not fetched, skipping ..."
  178.    fi
  179. }
  180.  
  181. build_libretro_vba()
  182. {
  183.    if [ -d "libretro-vba" ]; then
  184.       echo "=== Building VBA-Next ==="
  185.       cd libretro-vba/
  186.       $MAKE CC=$CC CXX=$CXX platform=win -f Makefile.libretro -j$JOBS clean || die "Failed to clean VBA-Next"
  187.       $MAKE CC=$CC CXX=$CXX platform=win -f Makefile.libretro -j$JOBS || die "Failed to build VBA-Next"
  188.       cp vba_next_retro.dll "$RARCH_DIST_DIR"/libretro-git-vba.dll
  189.       cd ..
  190.    else
  191.       echo "VBA-Next not fetched, skipping ..."
  192.    fi
  193. }
  194.  
  195. build_libretro_bnes()
  196. {
  197.    if [ -d "libretro-bnes" ]; then
  198.       echo "=== Building bNES ==="
  199.       cd libretro-bnes
  200.       mkdir -p obj
  201.       $MAKE CC=$CC CXX=$CXX platform=win -j$JOBS clean || die "Failed to clean bNES"
  202.       $MAKE CC=$CC CXX=$CXX platform=win -j$JOBS || die "Failed to build bNES"
  203.       cp retro.dll "$RARCH_DIST_DIR"/libretro-git-bnes.dll
  204.       cd ..
  205.    else
  206.       echo "bNES not fetched, skipping ..."
  207.    fi
  208. }
  209.  
  210. build_libretro_fceu()
  211. {
  212.    if [ -d "libretro-fceu" ]; then
  213.       echo "=== Building FCEU ==="
  214.       cd libretro-fceu
  215.       $MAKE CC=$CC CXX=$CXX platform=win -C fceumm-code -f Makefile.libretro -j$JOBS clean || die "Failed to clean FCEU"
  216.       $MAKE CC=$CC CXX=$CXX platform=win -C fceumm-code -f Makefile.libretro -j$JOBS || die "Failed to build FCEU"
  217.       cp fceumm-code/fceumm_retro.dll "$RARCH_DIST_DIR"/libretro-git-fceu.dll
  218.       cd ..
  219.    else
  220.       echo "FCEU not fetched, skipping ..."
  221.    fi
  222. }
  223.  
  224. build_libretro_gambatte()
  225. {
  226.    if [ -d "libretro-gambatte" ]; then
  227.       echo "=== Building Gambatte ==="
  228.       cd libretro-gambatte/libgambatte
  229.       $MAKE CC=$CC CXX=$CXX platform=win -f Makefile.libretro -j$JOBS clean || die "Failed to clean Gambatte"
  230.       $MAKE CC=$CC CXX=$CXX platform=win -f Makefile.libretro -j$JOBS || die "Failed to build Gambatte"
  231.       cp gambatte_retro.dll "$RARCH_DIST_DIR"/libretro-git-gambatte.dll
  232.       cd ../..
  233.    else
  234.       echo "Gambatte not fetched, skipping ..."
  235.    fi
  236. }
  237.  
  238. build_libretro_meteor()
  239. {
  240.    if [ -d "libretro-meteor" ]; then
  241.       echo "=== Building Meteor ==="
  242.       cd libretro-meteor/libretro
  243.       $MAKE platform=win CC=$CC CXX=$CXX -j$JOBS clean || die "Failed to clean Meteor"
  244.       $MAKE platform=win CC=$CC CXX=$CXX -j$JOBS || die "Failed to build Meteor"
  245.       cp retro.dll "$RARCH_DIST_DIR"/libretro-git-meteor.dll
  246.       cd ../..
  247.    else
  248.       echo "Meteor not fetched, skipping ..."
  249.    fi
  250. }
  251.  
  252. build_libretro_stella()
  253. {
  254.    if [ -d "libretro-stella" ]; then
  255.       echo "=== Building Stella ==="
  256.       cd libretro-stella
  257.       $MAKE platform=win CC=$CC CXX=$CXX -j$JOBS clean || die "Failed to clean Stella"
  258.       $MAKE platform=win CC=$CC CXX=$CXX -j$JOBS || die "Failed to build Stella"
  259.       cp stella_retro.dll "$RARCH_DIST_DIR"/libretro-git-stella.dll
  260.       cd ../
  261.    else
  262.       echo "Stella not fetched, skipping ..."
  263.    fi
  264. }
  265.  
  266. build_libretro_desmume()
  267. {
  268.    if [ -d "libretro-desmume" ]; then
  269.       echo "=== Building Desmume ==="
  270.       cd libretro-desmume
  271.       $MAKE platform=win CC=$CC CXX=$CXX -f Makefile.libretro -j$JOBS clean || die "Failed to clean Desmume"
  272.       $MAKE platform=win CC=$CC CXX=$CXX -f Makefile.libretro -j$JOBS || die "Failed to build Desmume"
  273.       cp retro.dll "$RARCH_DIST_DIR"/libretro-git-desmume.dll
  274.       cd ../
  275.    else
  276.       echo "Desmume not fetched, skipping ..."
  277.    fi
  278. }
  279.  
  280. build_libretro_quicknes()
  281. {
  282.    if [ -d "libretro-quicknes" ]; then
  283.       echo "=== Building QuickNES ==="
  284.       cd libretro-quicknes/libretro
  285.       $MAKE platform=win CC=$CC CXX=$CXX -j$JOBS clean || die "Failed to clean QuickNES"
  286.       $MAKE platform=win CC=$CC CXX=$CXX -j$JOBS || die "Failed to build QuickNES"
  287.       cp quicknes_retro.dll "$RARCH_DIST_DIR"/libretro-git-quicknes.dll
  288.       cd ../..
  289.    else
  290.       echo "QuickNES not fetched, skipping ..."
  291.    fi
  292. }
  293.  
  294. build_libretro_nestopia()
  295. {
  296.    if [ -d "libretro-nestopia" ]; then
  297.       echo "=== Building Nestopia ==="
  298.       cd libretro-nestopia/libretro
  299.       $MAKE platform=win CC=$CC CXX=$CXX -j$JOBS clean || die "Failed to clean Nestopia"
  300.       $MAKE platform=win CC=$CC CXX=$CXX -j$JOBS || die "Failed to build Nestopia"
  301.       cp nestopia_retro.dll "$RARCH_DIST_DIR"/libretro-144-nestopia.dll
  302.       cd ../..
  303.    else
  304.       echo "Nestopia not fetched, skipping ..."
  305.    fi
  306. }
  307.  
  308. mkdir -p "$RARCH_DIST_DIR"
  309.  
  310. if [ $1 ]; then
  311.    $1
  312. else
  313.    build_libretro_bsnes
  314.    build_libretro_mednafen
  315.    build_libretro_s9x
  316.    build_libretro_s9x_next
  317.    build_libretro_genplus
  318.    build_libretro_fba
  319.    build_libretro_vba
  320.    build_libretro_bnes
  321.    build_libretro_fceu
  322.    build_libretro_gambatte
  323.    build_libretro_meteor
  324.    build_libretro_stella
  325.    build_libretro_desmume
  326.    build_libretro_quicknes
  327.    build_libretro_nestopia
  328. fi
Advertisement
Add Comment
Please, Sign In to add comment