From fe5a9c3278a06395bcd493e95c47279e64395901 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 9 Feb 2019 15:08:29 +0100 Subject: [PATCH] automatically build GP2XCROSS install 32bits binary support to use GP2X toolchain --- .gitlab-ci.yml | 16 +++++++++++ .install-gp2x-toolchain.sh | 59 ++++++++++++++++++++++++++++++++++++++ src/Makefile | 17 ++++++++--- 3 files changed, 88 insertions(+), 4 deletions(-) create mode 100755 .install-gp2x-toolchain.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 16876032..03a42b84 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -72,3 +72,19 @@ job_atari: paths: - "*.zip" - "ATARI_JOB_ID" + +job_gp2x: + stage: build + before_script: + - dpkg --add-architecture i386 + - apt-get update -qq && apt-get install -y -qq zip dos2unix + - apt-get install -y -qq multiarch-support libc6:i386 + - "sh ./.install-gp2x-toolchain.sh" + script: + - "NOLUA=1 GP2XCROSS=1 make -j2 grafx2" + - "NOLUA=1 GP2XCROSS=1 make ziprelease" + - "echo $CI_JOB_ID > GP2X_JOB_ID" + artifacts: + paths: + - "*.zip" + - "GP2X_JOB_ID" diff --git a/.install-gp2x-toolchain.sh b/.install-gp2x-toolchain.sh new file mode 100755 index 00000000..85a09c73 --- /dev/null +++ b/.install-gp2x-toolchain.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +FILE="arm-open2x-linux-apps-gcc-4.1.1-glibc-2.3.6_i686_linux.tar.bz2.zip" +SHA256=ecb53e2799bbd6953621b2eedeed7280f5b03c3b2a6825607cafbe5dc1d545d8 +URLALT="http://www.open2x.org/open2x/toolchains/$FILE" +URL="http://nanard.free.fr/grafx2/$FILE" + +LIBS="open2x-libpack-20071903-gcc-4.1.1-glibc-2.3.6.tar.bz2.zip" +LIBSSHA256=31f46111c1d8bd38b720b292f65213adc624b050a614dab1199b56b35244efd7 +LIBSURL="http://nanard.free.fr/grafx2/$LIBS" +LIBSURLALT="http://www.open2x.org/open2x/toolchains/$LIBS" + +LIBS2=open2x-prerelease-libpack-20070307-gcc-4.1.1-glibc-2.3.6.zip +LIBS2SHA256=8eea174f7aa4ff174c488bf2d8419c7c9c03f999e3e4631b7c020dd311ef1199 +LIBS2URL="http://nanard.free.fr/grafx2/$LIBS2" +LIBS2URLALT="http://www.open2x.org/open2x/toolchains/$LIBS2" + +SUDO=$(which sudo || echo "") +if [ -z "$SUDO" ] ; then + echo "no sudo" +else + echo "sudo: $SUDO" +fi + +WGET=$(WGET=`which wget` ; \ + if [ "$?" = "0" ] && [ -x "$WGET" ] ; \ + then echo "$WGET -nv" ; \ + else echo 'curl -R -O -L' ; fi) + +TMP=$(mktemp -d) +cd ${TMP} + +$WGET "$URL" || $WGET "$URLALT" +if ! echo "$SHA256 $FILE" | shasum -c - ; then + echo "FAILED to check authenticity of GP2x toolchain archive" + exit 1 +fi + +$WGET "$LIBSURL" || $WGET "$LIBSURLALT" +if ! echo "$LIBSSHA256 $LIBS" | shasum -c - ; then + echo "FAILED to check authenticity of GP2x libpack archive" + exit 1 +fi + +$WGET "$LIBS2URL" || $WGET "$LIBS2URLALT" +if ! echo "$LIBS2SHA256 $LIBS2" | shasum -c - ; then + echo "FAILED to check authenticity of GP2x prerelease libpack archive" + exit 1 +fi + +cd / +$SUDO tar xjf "${TMP}/${FILE}" || exit 1 +echo "GP2x toolchain extracted to /opt/open2x" +cd /opt/open2x +$SUDO tar xjf "${TMP}/${LIBS}" || exit 1 +echo "GP2x libpack extracted to /opt/open2x" +cd /opt/open2x/gcc-4.1.1-glibc-2.3.6 +$SUDO unzip -o "${TMP}/${LIBS2}" || exit 1 +rm -r ${TMP} diff --git a/src/Makefile b/src/Makefile index 3e68f70b..835e0036 100644 --- a/src/Makefile +++ b/src/Makefile @@ -504,14 +504,23 @@ endif else ifdef GP2XCROSS #cross compile an exec for the gp2x - CC = /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-gcc + #CC = /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-gcc + CC = /opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/arm-open2x-linux-gcc BIN = ../bin/grafx2.gpe - COPT = -W -Wall -Wdeclaration-after-statement -pedantic -std=c99 -static -g -O$(OPTIM) -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include `/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/sdl-config --cflags` $(TTFCOPT) -D__GP2X__ $(TTFCOPT) $(JOYCOPT) $(LUACOPT) - LOPT = -static -lSDL_image `/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/sdl-config --static-libs` -ljpeg -lpng -lz -lm $(TTFLOPT) $(LUALOPT) + SDLCONFIG = /opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/sdl-config + COPT = -W -Wall -Wdeclaration-after-statement -pedantic -std=c99 -static -g -O$(OPTIM) + COPT += -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include + COPT += $(shell $(SDLCONFIG) --cflags) + COPT += -D__GP2X__ $(TTFCOPT) $(JOYCOPT) $(LUACOPT) + LOPT = -static + LOPT += $(shell $(SDLCONFIG) --static-libs) + LOPT += -lSDL_image -ljpeg -lpng -lz + LOPT += -lm $(TTFLOPT) $(LUALOPT) OBJDIR = ../obj/gp2x NOTTF = 1 PLATFORM = gp2x - STRIP = /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-strip + #STRIP = /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-strip + STRIP = /opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/arm-open2x-linux-strip JOYCOPT = -DUSE_JOYSTICK else ifdef GCWZERO