From 2c9092d244e75ad4156e77e0731fc3ff82e81e16 Mon Sep 17 00:00:00 2001
From: twinaphex <libretro@gmail.com>
Date: Tue, 1 Sep 2015 17:41:20 +0200
Subject: [PATCH] Merge wii-cores.sh and ngc-cores.sh into dist-cores.sh

---
 dist-scripts/dist-cores.sh | 19 +++++++++++++++++++
 dist-scripts/ngc-cores.sh  | 23 -----------------------
 dist-scripts/wii-cores.sh  | 27 ---------------------------
 3 files changed, 19 insertions(+), 50 deletions(-)
 delete mode 100755 dist-scripts/ngc-cores.sh
 delete mode 100755 dist-scripts/wii-cores.sh

diff --git a/dist-scripts/dist-cores.sh b/dist-scripts/dist-cores.sh
index ce72246b80..f85c780695 100755
--- a/dist-scripts/dist-cores.sh
+++ b/dist-scripts/dist-cores.sh
@@ -22,6 +22,17 @@ elif [ $PLATFORM = "vita" ] ; then
 platform=vita
 MAKEFILE_GRIFFIN=yes
 
+# Wii
+elif [ $PLATFORM = "wii" ] ; then
+platform=wii
+MAKEFILE_GRIFFIN=yes
+SALAMANDER=yes
+
+# NGC
+elif [ $PLATFORM = "ngc" ] ; then
+platform=ngc
+MAKEFILE_GRIFFIN=yes
+
 # DEX PS3
 elif [ $PLATFORM = "dex-ps3" ] ; then
 platform=ps3
@@ -119,6 +130,10 @@ for f in *_${platform}.a ; do
       mv -f ../EBOOT.PBP ../pkg/${platform}/cores/${name}_libretro.PBP
    elif [ $PLATFORM = "vita" ] ; then
       mv -f ../retroarch_${platform}.velf ../pkg/${platform}/${name}_libretro_${platform}.velf
+   elif [ $PLATFORM = "ngc" ] ; then
+      mv -f ../retroarch_${platform}.dol ../pkg/${platform}/${name}_libretro_${platform}.dol
+   elif [ $PLATFORM = "wii" ] ; then
+      mv -f ../retroarch_${platform}.dol ../pkg/${platform}/${name}_libretro_${platform}.dol
    fi
 
    # Remove executable files
@@ -128,6 +143,10 @@ for f in *_${platform}.a ; do
       rm -f ../retroarchpsp.elf
    elif [ $PLATFORM = "vita" ] ; then
       rm -f ../retroarch_${platform}.velf ../retroarch_${platform}.elf
+   elif [ $PLATFORM = "ngc" ] ; then
+      rm -f ../retroarch_${platform}.dol ../retroarch_${platform}.elf ../retroarch_${platform}.elf.map
+   elif [ $PLATFORM = "wii" ] ; then
+      rm -f ../retroarch_${platform}.dol ../retroarch_${platform}.elf ../retroarch_${platform}.elf.map
    fi
 
    # Do cleanup if this is a big stack core
diff --git a/dist-scripts/ngc-cores.sh b/dist-scripts/ngc-cores.sh
deleted file mode 100755
index 5b9d288f5b..0000000000
--- a/dist-scripts/ngc-cores.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-platform=ngc
-
-make -C ../ -f Makefile.griffin platform=${platform} clean || exit 1
-
-for f in *_${platform}.a ; do
-   name=`echo "$f" | sed "s/\(_libretro_${platform}\|\).a$//"`
-   whole_archive=
-   big_stack=
-   if [ $name = "nxengine" ] ; then
-      echo "NXEngine found, applying whole archive linking..."
-      whole_archive="WHOLE_ARCHIVE_LINK=1"
-   fi
-   if [ $name = "tyrquake" ] ; then
-      echo "Tyrquake found, applying big stack..."
-      big_stack="BIG_STACK=1"
-   fi
-   cp -f "$f" ../libretro_${platform}.a
-   make -C ../ -f Makefile.griffin platform=${platform} $whole_archive $big_stack -j3 || exit 1
-   mv -f ../retroarch_${platform}.dol ../pkg/${platform}/${name}_libretro_${platform}.dol
-   rm -f ../retroarch_${platform}.dol ../retroarch_${platform}.elf ../retroarch_${platform}.elf.map
-done
diff --git a/dist-scripts/wii-cores.sh b/dist-scripts/wii-cores.sh
deleted file mode 100755
index fb2cf3f4e6..0000000000
--- a/dist-scripts/wii-cores.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-
-platform=wii
-
-make -C ../ -f Makefile.${platform}.salamander clean || exit 1
-make -C ../ -f Makefile.griffin platform=${platform} clean || exit 1
-
-make -C ../ -f Makefile.${platform}.salamander || exit 1
-make -C ../ -f Makefile.${platform}.salamander pkg || exit 1
-
-for f in *_${platform}.a ; do
-   name=`echo "$f" | sed "s/\(_libretro_${platform}\|\).a$//"`
-   whole_archive=
-   big_stack=
-   if [ $name = "nxengine" ] ; then
-      echo "NXEngine found, applying whole archive linking..."
-      whole_archive="WHOLE_ARCHIVE_LINK=1"
-   fi
-   if [ $name = "tyrquake" ] ; then
-      echo "Tyrquake found, applying big stack..."
-      big_stack="BIG_STACK=1"
-   fi
-   cp -f "$f" ../libretro_${platform}.a
-   make -C ../ -f Makefile.griffin platform=${platform} $whole_archive $big_stack -j3 || exit 1
-   mv -f ../retroarch_${platform}.dol ../pkg/${platform}/${name}_libretro_${platform}.dol
-   rm -f ../retroarch_${platform}.dol ../retroarch_${platform}.elf ../retroarch_${platform}.elf.map
-done