From d04d1f93493f66cc5588ecf807df26306ac917c0 Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Wed, 1 Feb 2017 15:44:27 -0800 Subject: [PATCH] libretro-ppsspp: add package --- packages/emulation/libretro-ppsspp/package.mk | 73 ++++++++++++ ...bretro-ppsspp-0001_fix-cross-compile.patch | 14 +++ ...libretro-ppsspp-0002-aarch64-support.patch | 27 +++++ .../libretro-ppsspp-0003-ffmpeg-aarch64.patch | 104 ++++++++++++++++++ tools/mkpkg/mkpkg_libretro-ppsspp | 41 +++++++ 5 files changed, 259 insertions(+) create mode 100644 packages/emulation/libretro-ppsspp/package.mk create mode 100644 packages/emulation/libretro-ppsspp/patches/libretro-ppsspp-0001_fix-cross-compile.patch create mode 100644 packages/emulation/libretro-ppsspp/patches/libretro-ppsspp-0002-aarch64-support.patch create mode 100644 packages/emulation/libretro-ppsspp/patches/libretro-ppsspp-0003-ffmpeg-aarch64.patch create mode 100755 tools/mkpkg/mkpkg_libretro-ppsspp diff --git a/packages/emulation/libretro-ppsspp/package.mk b/packages/emulation/libretro-ppsspp/package.mk new file mode 100644 index 0000000000..cc69528ac3 --- /dev/null +++ b/packages/emulation/libretro-ppsspp/package.mk @@ -0,0 +1,73 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# LibreELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LibreELEC. If not, see . +################################################################################ + +PKG_NAME="libretro-ppsspp" +PKG_VERSION="e1bb9da" +PKG_ARCH="any" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/libretro/libretro-ppsspp" +PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain kodi-platform" +PKG_SECTION="emulation" +PKG_SHORTDESC="A PSP emulator for Android, Windows, Mac, Linux and Blackberry 10, written in C++." +PKG_LONGDESC="A PSP emulator for Android, Windows, Mac, Linux and Blackberry 10, written in C++." +PKG_AUTORECONF="no" +PKG_IS_ADDON="no" + +PKG_LIBNAME="ppsspp_libretro.so" +PKG_LIBPATH="libretro/$PKG_LIBNAME" +PKG_LIBVAR="PPSSPP_LIB" + +pre_configure_target() { + # fails to build in subdirs + cd $ROOT/$PKG_BUILD + rm -rf .$TARGET_NAME +} + +pre_make_target() { + export CFLAGS="$CFLAGS -I$SYSROOT_PREFIX/usr/include/interface/vcos/pthreads" + export CXXFLAGS="$CXXFLAGS -I$SYSROOT_PREFIX/usr/include/interface/vcos/pthreads" + strip_lto +} + +make_target() { + case $PROJECT in + RPi) + make -C libretro platform=armv6-gles-hardfloat-arm1176jzf-s + ;; + RPi2) + make -C libretro platform=armv7-neon-gles-hardfloat-cortex-a7 + ;; + imx6) + make -C libretro platform=armv7-neon-gles-hardfloat-cortex-a9 + ;; + WeTek_Play) + make -C libretro platform=armv7-neon-gles-hardfloat-cortex-a9 + ;; + Generic) + make -C libretro + ;; + esac +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/lib + cp $PKG_LIBPATH $INSTALL/usr/lib/$PKG_LIBNAME + echo "set($PKG_LIBVAR $INSTALL/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/$PKG_NAME-config.cmake +} + diff --git a/packages/emulation/libretro-ppsspp/patches/libretro-ppsspp-0001_fix-cross-compile.patch b/packages/emulation/libretro-ppsspp/patches/libretro-ppsspp-0001_fix-cross-compile.patch new file mode 100644 index 0000000000..b16a9b20d8 --- /dev/null +++ b/packages/emulation/libretro-ppsspp/patches/libretro-ppsspp-0001_fix-cross-compile.patch @@ -0,0 +1,14 @@ +diff -Naur a/libretro/Makefile b/libretro/Makefile +--- a/libretro/Makefile 2016-01-19 10:11:20.000000000 +0100 ++++ b/libretro/Makefile 2016-01-19 10:27:00.009866912 +0100 +@@ -201,8 +201,8 @@ + + # ARM + else ifneq (,$(findstring armv,$(platform))) +- CC = gcc +- CXX = g++ ++ CC ?= gcc ++ CXX ?= g++ + TARGET := $(TARGET_NAME)_libretro.so + fpic := -fPIC + LDFLAGS += -shared -Wl,--version-script=link.T -Wl,--no-undefined diff --git a/packages/emulation/libretro-ppsspp/patches/libretro-ppsspp-0002-aarch64-support.patch b/packages/emulation/libretro-ppsspp/patches/libretro-ppsspp-0002-aarch64-support.patch new file mode 100644 index 0000000000..2139780e7d --- /dev/null +++ b/packages/emulation/libretro-ppsspp/patches/libretro-ppsspp-0002-aarch64-support.patch @@ -0,0 +1,27 @@ +diff -Naur a/libretro/Makefile b/libretro/Makefile +--- a/libretro/Makefile 2016-05-10 10:13:03.235599098 -0700 ++++ b/libretro/Makefile 2016-05-10 10:41:33.975635164 -0700 +@@ -237,6 +237,23 @@ + PLATCFLAGS += -DARM + LDFLAGS += -lrt -ldl + ++# aarch64 ++else ifneq (,$(findstring aarch64,$(platform))) ++ CC ?= gcc ++ CXX ?= g++ ++ TARGET := $(TARGET_NAME)_libretro.so ++ fpic := -fPIC ++ LDFLAGS += -shared -Wl,--version-script=link.T -Wl,--no-undefined ++ FFMPEGINCFLAGS += -I$(FFMPEGDIR)/linux/$(FFMPEG_ARCH)/include ++ FFMPEGLIBDIR := $(FFMPEGDIR)/linux/$(FFMPEG_ARCH)/lib ++ FFMPEGLDFLAGS += -L$(FFMPEGLIBDIR) -lavformat -lavcodec -lavutil -lswresample -lswscale ++ INCFLAGS += -I. ++ WITH_DYNAREC=arm64 ++ GLES := 1 ++ GL_LIB := -lGLESv2 -lEGL ++ LDFLAGS += -lGLESv2 -lEGL ++ LDFLAGS += -lrt -ldl ++ + # emscripten + else ifeq ($(platform), emscripten) + TARGET := $(TARGET_NAME)_libretro_emscripten.bc diff --git a/packages/emulation/libretro-ppsspp/patches/libretro-ppsspp-0003-ffmpeg-aarch64.patch b/packages/emulation/libretro-ppsspp/patches/libretro-ppsspp-0003-ffmpeg-aarch64.patch new file mode 100644 index 0000000000..f6f5c7ef9b --- /dev/null +++ b/packages/emulation/libretro-ppsspp/patches/libretro-ppsspp-0003-ffmpeg-aarch64.patch @@ -0,0 +1,104 @@ +diff -Naur a/ffmpeg/linux_aarch64.sh b/ffmpeg/linux_aarch64.sh +--- a/ffmpeg/linux_aarch64.sh 1969-12-31 16:00:00.000000000 -0800 ++++ b/ffmpeg/linux_aarch64.sh 2016-05-10 10:27:20.971393139 -0700 +@@ -0,0 +1,100 @@ ++#!/bin/bash ++ ++GENERAL="\ ++ --enable-cross-compile \ ++ --extra-libs="-lgcc" \ ++ --arch=aarch64 \ ++ --cc=aarch64-libreelec-linux-gnueabi-gcc \ ++ --cross-prefix=aarch64-libreelec-linux-gnueabi- \ ++ --nm=aarch64-libreelec-linux-gnueabi-nm" ++ ++MODULES="\ ++ --disable-avdevice \ ++ --disable-filters \ ++ --disable-programs \ ++ --disable-network \ ++ --disable-avfilter \ ++ --disable-postproc \ ++ --disable-encoders \ ++ --disable-protocols \ ++ --disable-hwaccels \ ++ --disable-doc" ++ ++VIDEO_DECODERS="\ ++ --enable-decoder=h264 \ ++ --enable-decoder=mpeg4 \ ++ --enable-decoder=mpeg2video \ ++ --enable-decoder=mjpeg \ ++ --enable-decoder=mjpegb" ++ ++AUDIO_DECODERS="\ ++ --enable-decoder=aac \ ++ --enable-decoder=aac_latm \ ++ --enable-decoder=atrac3 \ ++ --enable-decoder=atrac3p \ ++ --enable-decoder=mp3 \ ++ --enable-decoder=pcm_s16le \ ++ --enable-decoder=pcm_s8" ++ ++DEMUXERS="\ ++ --enable-demuxer=h264 \ ++ --enable-demuxer=m4v \ ++ --enable-demuxer=mpegvideo \ ++ --enable-demuxer=mpegps \ ++ --enable-demuxer=mp3 \ ++ --enable-demuxer=avi \ ++ --enable-demuxer=aac \ ++ --enable-demuxer=pmp \ ++ --enable-demuxer=oma \ ++ --enable-demuxer=pcm_s16le \ ++ --enable-demuxer=pcm_s8 \ ++ --enable-demuxer=wav" ++ ++VIDEO_ENCODERS="\ ++ --enable-encoder=huffyuv \ ++ --enable-encoder=ffv1 \ ++ --enable-encoder=mjpeg" ++ ++AUDIO_ENCODERS="\ ++ --enable-encoder=pcm_s16le" ++ ++MUXERS="\ ++ --enable-muxer=avi" ++ ++ ++PARSERS="\ ++ --enable-parser=h264 \ ++ --enable-parser=mpeg4video \ ++ --enable-parser=mpegaudio \ ++ --enable-parser=mpegvideo \ ++ --enable-parser=aac \ ++ --enable-parser=aac_latm" ++ ++ ++function build_aarch64 ++{ ++./configure --target-os=linux \ ++ --prefix=./linux/aarch64 \ ++ ${GENERAL} \ ++ --extra-cflags=" -O3 -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing -finline-limit=300" \ ++ --disable-shared \ ++ --enable-static \ ++ --enable-zlib \ ++ --enable-pic \ ++ --disable-everything \ ++ ${MODULES} \ ++ ${VIDEO_DECODERS} \ ++ ${AUDIO_DECODERS} \ ++ ${VIDEO_ENCODERS} \ ++ ${AUDIO_ENCODERS} \ ++ ${DEMUXERS} \ ++ ${MUXERS} \ ++ ${PARSERS} \ ++ --disable-neon ++ ++make clean ++make install ++} ++ ++build_aarch64 ++echo Linux aarch64 build finished diff --git a/tools/mkpkg/mkpkg_libretro-ppsspp b/tools/mkpkg/mkpkg_libretro-ppsspp new file mode 100755 index 0000000000..55b587bce2 --- /dev/null +++ b/tools/mkpkg/mkpkg_libretro-ppsspp @@ -0,0 +1,41 @@ +#!/bin/sh +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# OpenELEC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC. If not, see . +################################################################################ + +echo "getting sources..." + if [ ! -d libretro-ppsspp.git ]; then + git clone --depth=1 --recursive https://github.com/libretro/libretro-ppsspp libretro-ppsspp.git + fi + + cd libretro-ppsspp.git + git pull + GIT_REV=`git log -n1 --format=%h` + cd .. + +echo "copying sources..." + rm -rf libretro-ppsspp-$GIT_REV + cp -R libretro-ppsspp.git libretro-ppsspp-$GIT_REV + +echo "cleaning sources..." + rm -rf libretro-ppsspp-$GIT_REV/.git + +echo "packing sources..." + tar cvJf libretro-ppsspp-$GIT_REV.tar.xz libretro-ppsspp-$GIT_REV + +echo "remove temporary sourcedir..." + rm -rf libretro-ppsspp-$GIT_REV