Add extra arguments to generic makefiles so it can cover most cases

This commit is contained in:
AndresSM 2014-11-05 19:40:39 -08:00
parent 2c78f4a4e4
commit ea0ddaa702
3 changed files with 157 additions and 30 deletions

View File

@ -1,4 +1,6 @@
libretro-bsnes https://github.com/libretro/bsnes-libretro.git project NO GENERIC Makefile .
libretro-mame https://github.com/libretro/bsnes-libretro.git project NO GENERIC Makefile .
libretro-tgbdual https://github.com/libretro/tgbdual-libretro.git project YES GENERIC Makefile .
tgbdual libretro-tgbdual https://github.com/libretro/tgbdual-libretro.git project NO GENERIC Makefile .
fb_alpha libretro-fba https://github.com/libretro/fba-libretro.git project NO GENERIC makefile.libretro svn-current/trunk
fba_cores_cps1 libretro-fba https://github.com/libretro/fba-libretro.git project NO GENERIC makefile.libretro svn-current/trunk/fbacores/cps1
fba_cores_cps2 libretro-fba https://github.com/libretro/fba-libretro.git project NO GENERIC makefile.libretro svn-current/trunk/fbacores/cps2
fba_cores_neo libretro-fba https://github.com/libretro/fba-libretro.git project NO GENERIC makefile.libretro svn-current/trunk/fbacores/neogeo
pcsx_rearmed libretro-pcsx_rearmed https://github.com/libretro/pcsx_rearmed.git project YES GENERIC Makefile.libretro . USE_DYNAREC=0 TEST=1

View File

@ -22,8 +22,6 @@ if [[ -n "$PROCESSOR_ARCHITEW6432" && $PROCESSOR_ARCHITEW6432 -eq "AMD64" ]]; th
X86=true && X86_64=true
fi
echo "$ARCH CPU detected"
if command -v nproc >/dev/null; then
JOBS=$(nproc)
else
@ -57,6 +55,11 @@ esac
export FORMAT_COMPILER_TARGET_ALT="$FORMAT_COMPILER_TARGET"
echo "PLATFORM: $platform"
echo "ARCHITECTURE: $ARCH"
echo "TARGET: $FORMAT_COMPILER_TARGET"
#if uncommented, will fetch repos with read+write access. Useful for committers
#export WRITERIGHTS=1
@ -127,3 +130,4 @@ export RA_ANDROID_MIN_API=android-9
if [ -f "libretro-config-user.sh" ]; then
. ./libretro-config-user.sh
fi

View File

@ -1,30 +1,114 @@
#!/bin/bash
. ./libretro-config.sh
#usage:
####usage:
# ./libretro-fetch-and-build.sh configfile
# if you want to force all enabled cores to rebuild prepend FORCE=YES
# you may need to specify your make command by prepending it to the commandline, for instance MAKE=mingw32-make
#
# eg: FORCE=YES MAKE=mingw32-make ./libretro-fetch-and-build.sh buildbot.conf
####environment configuration:
echo configuring build environment
. ./libretro-config.sh
#build commands
# BSDs don't have readlink -f
read_link()
{
TARGET_FILE="$1"
cd $(dirname "$TARGET_FILE")
TARGET_FILE=$(basename "$TARGET_FILE")
while [ -L "$TARGET_FILE" ]
do
TARGET_FILE=$(readlink "$TARGET_FILE")
cd $(dirname "$TARGET_FILE")
TARGET_FILE=$(basename "$TARGET_FILE")
done
PHYS_DIR=$(pwd -P)
RESULT="$PHYS_DIR/$TARGET_FILE"
echo $RESULT
}
SCRIPT=$(read_link "$0")
echo "SCRIPT: $SCRIPT"
BASE_DIR=$(dirname "$SCRIPT")
if [ -z "$RARCH_DIST_DIR" ]; then
RARCH_DIR="$BASE_DIR/dist"
RARCH_DIST_DIR="$RARCH_DIR/$DIST_DIR"
fi
mkdir -p "$RARCH_DIST_DIR"
if [ "$HOST_CC" ]; then
CC="${HOST_CC}-gcc"
CXX="${HOST_CC}-g++"
CXX11="${HOST_CC}-g++"
STRIP="${HOST_CC}-strip"
fi
if [ -z "$MAKE" ]; then
if uname -s | grep -i MINGW32 > /dev/null 2>&1; then
MAKE=mingw32-make
else
if type gmake > /dev/null 2>&1; then
MAKE=gmake
else
MAKE=make
fi
fi
fi
if [ -z "$CC" ]; then
if [ $FORMAT_COMPILER_TARGET = "osx" ]; then
CC=cc
elif uname -s | grep -i MINGW32 > /dev/null 2>&1; then
CC=mingw32-gcc
else
CC=gcc
fi
fi
if [ -z "$CXX" ]; then
if [ $FORMAT_COMPILER_TARGET = "osx" ]; then
CXX=c++
CXX11="clang++ -std=c++11 -stdlib=libc++"
elif uname -s | grep -i MINGW32 > /dev/null 2>&1; then
CXX=mingw32-g++
CXX11=mingw32-g++
else
CXX=g++
CXX11=g++
fi
fi
echo
echo "CC = $CC"
echo "CXX = $CXX"
echo "STRIP = $STRIP"
echo
cd "${BASE_DIR}"
####build commands
build_libretro_generic_makefile() {
DIR=$1
SUBDIR=$2
MAKEFILE=$3
PLATFORM=$4
NAME=$1
DIR=$2
SUBDIR=$3
MAKEFILE=$4
PLATFORM=$5
SILENT=$5
cd $DIR
cd $SUBDIR
if [ -z "${NOCLEAN}" ];
then
echo "cleaning up..."
"${MAKE}" "${SILENT}" platform="${4}" ${COMPILER} "-j${JOBS}" clean
echo "cleanup command: ${MAKE} -f ${MAKEFILE} platform=${PLATFORM} ${COMPILER} -j${JOBS} clean"
${MAKE} -f ${MAKEFILE} platform=${PLATFORM} ${COMPILER} -j${JOBS} clean
if [ $? -eq 0 ];
then
echo success!
@ -34,11 +118,12 @@ build_libretro_generic_makefile() {
fi
echo "compiling..."
"${MAKE}" "${SILENT}" platform="${4}" ${COMPILER} "-j${JOBS}"
echo "buid command: ${MAKE} -f ${MAKEFILE} platform=${PLATFORM} ${COMPILER} -j${JOBS}"
${MAKE} -f ${MAKEFILE} platform=${PLATFORM} ${COMPILER} -j${JOBS}
if [ $? -eq 0 ];
then
echo success!
cp ${NAME}_libretro$FORMAT.${FORMAT_EXT} $RARCH_DIST_DIR/${NAME}_libretro$FORMAT.${FORMAT_EXT}
else
echo error while compiling $1
fi
@ -49,25 +134,56 @@ build_libretro_generic_makefile() {
#fetch a project and mark it for building if there have been any changes
while read line; do
NAME=`echo $line | cut --fields=1 --delimiter=" "`
URL=`echo $line | cut --fields=2 --delimiter=" "`
TYPE=`echo $line | cut --fields=3 --delimiter=" "`
ENABLED=`echo $line | cut --fields=4 --delimiter=" "`
COMMAND=`echo $line | cut --fields=5 --delimiter=" "`
MAKEFILE=`echo $line | cut --fields=6 --delimiter=" "`
SUBDIR=`echo $line | cut --fields=7 --delimiter=" "`
NAME=`echo $line | cut --fields=1 --delimiter=" "`
DIR=`echo $line | cut --fields=2 --delimiter=" "`
URL=`echo $line | cut --fields=3 --delimiter=" "`
TYPE=`echo $line | cut --fields=4 --delimiter=" "`
ENABLED=`echo $line | cut --fields=5 --delimiter=" "`
COMMAND=`echo $line | cut --fields=6 --delimiter=" "`
MAKEFILE=`echo $line | cut --fields=7 --delimiter=" "`
SUBDIR=`echo $line | cut --fields=8 --delimiter=" "`
if [ "${ENABLED}" == "YES" ];
then
echo "Processing $NAME"
echo ====================================
if [ -d "${NAME}/.git" ];
echo ============================================
echo URL: $URL
echo REPO TYPE: $TYPE
echo ENABLED: $ENABLED
echo COMMAND: $COMMAND
echo MAKEFILE: $MAKEFILE
echo
echo
ARGS=""
TEMP=`echo $line | cut --fields=9 --delimiter=" "`
if [ -n ${TEMP} ];
then
cd $NAME
ARGS="${TEMP}"
fi
TEMP=""
TEMP=`echo $line | cut --fields=10 --delimiter=" "`
if [ -n ${TEMP} ];
then
ARGS="${ARGS} ${TEMP}"
fi
TEMP=""
TEMP=`echo $line | cut --fields=11 --delimiter=" "`
if [ -n ${TEMP} ];
then
ARGS="${ARGS} ${TEMP}"
fi
echo ARGS: $ARGS
if [ -d "${DIR}/.git" ];
then
cd $DIR
echo "pulling from repo... "
OUT=`git pull`
if [[ $OUT == *up-to-date* ]]
if [[ $OUT == *"Already up-to-date"* ]]
then
BUILD="NO"
else
@ -78,18 +194,23 @@ while read line; do
else
echo "cloning repo..."
git clone --depth=1 "$URL" "$NAME"
git clone --depth=1 "$URL" "$DIR"
BUILD="YES"
fi
if [ "${BUILD}" == "YES" -o "${FORCE}" == "YES" ];
then
echo building core...
build_libretro_generic_makefile $NAME $SUBDIR $MAKEFILE ${FORMAT_COMPILER_TARGET} "-s"
if [ "${COMMAND}" == "GENERIC" ]; then
build_libretro_generic_makefile $NAME $DIR $SUBDIR $MAKEFILE ${FORMAT_COMPILER_TARGET}
fi
else
echo core already up-to-date...
fi
fi
cd "${BASE_DIR}"
done < $1