Merge pull request #173 from iKarith/master

Starting to work on new build scripts
This commit is contained in:
Twinaphex 2015-02-08 15:50:42 +01:00
commit 98705ef45b
6 changed files with 2025 additions and 0 deletions

462
README.iKarith.md Normal file
View File

@ -0,0 +1,462 @@
First, an introduction is in order:
Hi, I'm iKarith, and probably you don't know me. :) I'm not really part of
any "scene" or anything. Long story short, I wanted to build a stand-alone
emulator-based box for my fiancée and thought RetroArch might give her
something clean, seamless, and foolproof once I set it up. And as some of
you who haven't been big fans of RetroArch may guess, that wasn't easy.
Two choices existed: Complain, or fix it. I chose to fix it. And when I
found out where things were headed for RetroArch, I decided to first see about
improving its build process.
To that end, this file and the files in the repo with "iKarith" in the name
were created. They're temporary and will go away once this project's done.
This file in particular explains what I'm doing and why. So read on if that
stuff interests you. :)
iKarith, 2015-02-07
## History
2015-02-08.1: Extensive rewrite of future direction portions
2015-02-08.0: Added discussion of dependencies
2015-02-07.1: Changed heading levels
2015-02-07.0: initial writing
## Some philosophy
Libretro should be an API, not a project. You might want to argue with me as
to whether or not that's true. And you might be surprised to find me agree
that as of today, it *is* a project and not an API. But that model is IMO not
infinitely sustainable. You can't just fork every open source game project
out there.
You can't even do that with all the emulators. And even if you could, it'd be
a nightmare trying to compile them all, let alone maintain them. And it's
just not realistic to hand a user a dozen SNES emulators with no explanation
of what's what and expect them to know what to do with them all, especially
since there are multiple versions of some of them. Now multiply that by all
of the systems and all of the emulator engines and all of the versions of some
of them that exist. It just does not scale.
### The technical problem
Leaving aside the philosophical direction of where libretro is headed for a
moment, its build scripts don't really function well for where the project is
at today, let alone in the future when it's "not really a project" anymore.
You see, libretro does not have one build script. In fact, it doesn't even
have one build script per target platform. No, there's the combination of
libretro-fetch.sh, libretro-build.sh, and retroarch-build.sh and their
included subscript dependencies. In addition, there's about a dozen or so
platform-specific build scripts which have some overlap with the main scripts
and (inconsistently) use their dependent subscripts. In addition, there's a
handful of XCode projects for Mac OS X which are intended to be backward
compatible with old versions of the OS but aren't. And there's a whole
additional set of build scripts replacing most of these almost in their
entirety written for the buildbot. And then there's the Makefiles which
are often just as much of a mess (but a separate problem…)
This is why the iKarith-\*.sh scripts. If you touch any of the mainline
scripts to do what we need to do, you *will* break something. In fact, I
happen to know that most of the scripts need a (fairly trivial) patch as it
is. Mea culpa for introducing the need, but those scripts that don't get
patched before I get to them are the ones I can assume may have suffered other
forms of bit rot and will require additional care/testing.
### The Political Problem?
As I said, I don't really know anybody. So I can't pretend to understand all
of the issues involved with devs in the various "scenes" in question. I know
some people feel that they should retain control of their projects. I have
seen someone accuse libretro of trying to "steal" other projects to improve
their own. There are probably other issues, some of them personal, and I just
don't know them. And I don't need to, honestly.
What I can say is that what I have in mind for the new build system makes
libretro-super function kind of like Debian/Ubuntu's package system. You give
it the equivalent of an apt sources.list entry and it should be able to
download your project from your site, build it for your system, package it,
and possibly even give you the means to upload it to a repository.
My own future interests involve building a standalone libretro player for a
single project so that you can build something that targets the API and
distribute it as a stand-alone game, and a small version of SDL that's built
for libretro so that SDL-based games could be compiled for use on lakka.TV
down the line. Remember what I said I originally wanted to accomplish?
I don't know if any of this stuff will help or hinder resolution of any
outstanding issues between anyone. I'm just here to make cool stuff easy
enough for my fiancée to use it, remember? :)
## Dependencies
For all the discussion of "no external dependencies", libretro and the stuff
ported to it have a lot of them. That's unavoidable, actually. To simplify
the argument, let's presume a GNU/Linux build environment. You can't compile
anything without a compiler and binutils. And the only way you're going to
compile large batches of code is a dependency on make. Those are obvious.
### The less obvious dependencies
Continuing with our Linux example, all make does is give you a way to specify
what commands are required to create/update a file, and what files it is
created from. From there, the commands are executed in a shell, which
introduces a dependency on the shell, but also the shell commands. Things
like echo and cp are not traditionally "builtins", but rather external
programs that were traditionally smaller than the ELF header required to tell
Linux how to run them. (And old enough versions of Linux didn't use ELF…)
By this point you've got literally 500MB of dependencies on a modern Linux
system. You could argue that some of that is irrelevant because classically
all of the above fit into 50MB on a Linux system dating back to a 1.x kernel
and the fact that the dependencies have bloated so much (largely for UTF-8,
translation, internationalization, etc.) isn't our problem. That's fair
enough, but we still have a minimum of 50MB of build dependencies on Linux.
Add the build scripts in there and you add dependencies on git (which means
also perl and possibly python though nothing we do requires anything that uses
python until you try to build mame at least) and explicitly on bash. I'm
pretty sure our current build scripts will run on bash 2.05 at least, but most
folks assume bash 4 is available on all systems these days. (It's not—the Mac
still comes with bash 3.)
If we remove the bash dependency, we could claim a POSIX environment as a
build dependency, but notably some platforms are not and do not even pretend
to be POSIX, such as that little insignificant OS called Windows. You could
install MSYS (or more likely MSYS2) to try and fake it at the shell script
level, but MSYS2 is one *significant* dependency.
This is why autoconf exists. It's also why autoconf is the gigantic mess
(both in terms of size and ugly complexity) that it is: It cannot assume a
fully POSIX system, and the POSIX standard is pretty dated anyway. It has to
figure out all of the quirks of UNIX-style (and non-UNIX) systems running on 8
bit processors that haven't been updated in 35 years or more.
### So, what's your point?
The point is that we cannot say that we have no, or even few build
dependencies. And at present, the ones we do have are not declared. Fixing
this can be done in three ways, two of which aren't really worthwhile:
1. We can use autoconf. In addition to all the reasons why this idea just
sucks, the fact is that it won't solve our problem anyway because some
cores have build dependencies, even if they should be free of external
runtime dependencies. Not only that, we cannot easily predict if down the
line you want to use libretro-super to build a core out of a mercurial or
subversion repository.
2. We could try to reinvent autoconf for our purposes. This has the advantage
that we could build a system that accommodates our build system's needs and
also provides a means for cores to declare additional build dependencies if
they need them. It has the obvious disadvantage that no attempt to replace
autoconf has ever really been successful for a reason. Either you have to
introduce an external dependency (as cmake did) or you have to mix a bunch
of 1970s-era script syntaxes like autoconf does because they're the only
ones you can guarantee are installed everywhere.
3. We can simply state our dependencies from the outset and expect the user of
libretro-super to meet them. We may have to jump through a few hoops to
deal with where things are installed. For example, our scripts might be
best run using the same /usr/bin/env tactic used by Python developers to
avoid hard-coding a path that isn't portable. I'm told that the byuu, the
primary developer behind bsnes/higan, has a philosophy of not limiting
himself to legacy cruft when something better exists. To the extent that
is actually a reasonable thing to do, it's not a bad idea.
This doesn't solve the core build dependency issue by itself, but it does
assure that if the libretro-super user has installed the prerequisites for
using libretro-super, we CAN solve that problem without resorting to the
kind of abomination that is autoconf.
Obviously I see but one choice here. However care needs to be exercised still
to ensure that our libretro-super dependencies are in fact __reasonable__. I
would love to be able to take advantage of modern versions of bash, for
example, but Mac OS X users don't have it unless they installed it themselves.
It's not even guaranteed with MacPorts or Fink installed, so it's a different
issue than on Windows where people are going to have to install something no
matter what we use.
(Yes, I know bash 3 is ancient, but MacPorts and Fink both get along with it
just fine, and only bash scripters really ever notice the difference. If you
want to convince Twinaphex that it's a reasonable dependency, I'll join you in
doing so—but if it isn't packaged for PowerPC 10.5 systems, he's going to veto
the idea from the start and so will I. Yes, RetroArch doesn't currently build
on 10.5 systems. If I can reasonably correct that at some point, I will. No,
10.4 and older isn't necessary.)
## The solution so far
To begin, let's discuss the proof of concept I wrote before even beginning
this README. We can decide where it goes from there afterward. We'll be
using the incredibly simple 2048 project as a working example, I like it
because it's as close to a fully functional "hello world" for libretro as I
can imagine. Presently it fetches and compiles with these rules:
```bash
fetch_libretro_2048() {
fetch_git "$REPO_BASE/libretro/libretro-2048.git" "libretro-2048" "libretro/2048"
}
build_libretro_2048() {
build_libretro_generic_makefile "2048" "." "Makefile.libretro" ${FORMAT_COMPILER_TARGET}
}
```
Okay, so I turned that into a pile of shell variables:
```bash
core_2048_dir="libretro-2048"
core_2048_fetch=fetch_git
core_2048_source="$REPO_BASE/libretro/libretro-2048.git"
core_2048_build_rule=build_libretro_generic_makefile_s
core_2048_makefile="Makefile.libretro"
core_2048_other_args="$FORMAT_COMPILER_TARGET"
```
There's no need for $REPO_BASE for "write access" using github, and github
actually recommends everyone use https anyway. (They've flip-flopped on this
a few times over the years.)
The first real change here is build_libretro_generic_makefile_s, a version of
the build_libretro_generic_makefile rule written to use a set of shell
variables instead of positional parameters. You'll notice there's no variable
for subdir defined because no subdir is needed and therefore the rule doesn't
use one.
The fetch and build rules could be implicit as well since those would be the
defaults. Actually, the only things 2048 uses that cannot be implicit
defaults are obviously the source repository and its use of something other
than ``makefile`` or ``Makefile``.
This proof of concept uses shell variables, but it could just as easily have
used an ini file format like so:
```ini
[2048]
source = "https://github.com/libretro/libretro-2048.git"
makefile = "Makefile.libretro"
```
or an RFC-822 style format ala Debian Packages files:
```
Core: 2048
Source: https://github.com/libretro/libretro-2048.git
Makefile: Makefile.libretro
```
or even possibly in the .info file:
```ini
display_name = "2048"
authors = "Gabriele Cirulli"
supported_extensions = ""
corename = "2048"
categories = "Game"
systemname = "2048 game clone"
license = "GPLv3"
permissions = ""
display_version = "1.0"
supports_no_game = "true"
source = "https://github.com/libretro/libretro-2048.git"
makefile = "Makefile.libretro"
```
I like the notion of the second option actually even better than the third.
I'll explain why when I get to XXX
## Where to go from here
We need a better replacement for $platform and $FORMAT_COMPILER_TARGET and its
often identical $FORMAT_COMPILER_TARGET_ALT. I dunno about you, but my
primary workstation has three compiler suites installed that can collectively
generate code for two platforms and eight major processor architectures. I
can currently run two of the processor architectures, compiled for either of
the two platforms. I used to have a computer that could run three other
architectures on one of those platforms, but no longer do. I have a Mac, and
as far as libretro is concerned a present, that's all grossly oversimplified
to just "osx". WTF! That's gotta be fixed.
Next, as already noted there's some confusion outside of libretro circles
about the scope of libretro, namely that it is intended to be first and
foremost an API to be implemented by programs called "players" and packages
called "cores". If libretro-super is supposed to be an easy way to build
these things, then players and cores need to simply be definitions that you
can drop in to libretro-super and use, regardless of where they come from.
### A better platform designation
Currently the CPU you're building for is stored in the variable ARCH. The
platform may be specified in a couple of different formats in the $platform
variable, and $FORMAT_COMPILER_TARGET and $FORMAT_COMPILER_TARGET_ALT in a
canonical format. But as I said on my Mac will all its build possibilities
they all boil down to "osx". At the very least, a platform designation should
be specified as a canonical pairing of an OS target and an architecture
target. An evolution from what we have now would be to call my system
``MacOSX-x86_64``. Other valid architectures for Mac OS X are i386, ppc,
ppc64, and ppc970. (For those who don't know, ppc970 is compatible with ppc64
code, but not the other way around, though I don't know how important 64 bit
CPU support is on those G5 Macs with their typical RAM constraints.)
The best way would be to determine which compilers were available for a given
language and how to invoke them. At least on my system Clang and one of the
gcc's should be picked up for C, C++, and Obj-C for pretty much every
standard. And these would be defined for my current platform target of
MacOSX-x86_64.
But it shouldn't stop there. On all modern x86_64 systems, it is possible to
compile an (usually) run iX86 code. Our build system should determine if you
have the ability to do it and give you the option of doing so instead of or
addition to the x86_64 option. Users don't need that, but developers do.
Likewise for PowerPC and ARM architectures, there might be more than one CPU
target possible.
Mac OS X and iOS introduce another spanner in the works in that they support
compiling these multiple targets and joining them together using a tool called
lipo. The compiler will do this for you in most cases. Basically if any
CPU-specific features are determined by reading system headers or
compiler-defined variables, you just specify -arch i386 -arch x86_64 on the
compiler and linker command lines and you get both in one library/program. If
you're hard-coding things like whether to use 32 or 64 bit structures on the
command line \*cough\*mupen64plus\*cough\*, you're going to have to build it
twice and use lipo or better yet, patch the code to figure out these
structural differences from the compile environment provided.
We have some support for fat binaries on OS X currently, but it's a proof of
concept only that illustrates the limitations of our current build scripts
more than anything.
### Packages files
If libretro-super is going to be just a build environment for things built
around the libretro API in a highly scalable fashion, we need a way for people
to drop in their own fetch and build methods, as well as package rules for
players and cores.
Let's say the SuperTux developers port their game to libretro. Pretty sweet
right? In order to build this using libretro-super, you'd need a set of build
rules for it. The SuperTux folks could provide you with a URL for a packages
file which you could either download and drop into libretro-super yourself, or
you could give the URL to libretro-super and let it download it for you.
(Dependency on either wget or curl there—everybody has at least one or the
other though so that's fine.)
If you do let libretro-super download it for you, it could periodically check
to see if it has changed and update it if needed. Think apt-add-repository
from Ubuntu. Key signing and verification is not yet planned, but if you can
come up with an intelligent and minimalistic way to do it, I'm interested. :)
### Actions and targets
At this point, libretro is a __MASSIVE__ project, which is kind of impressive
for something that's not really supposed to be a project at all. There are
something approaching 70 individual cores including three versions of MAME,
three versions of standalone bSNES, and more. Users do not need all of that.
The average developer doesn't even need all of that. The only people who do
are the people running the buildbots that package all of the stuff that is
currently maintained by libretro developers.
The whole reason libretro-super exists is to give libretro developers an easy
way to build all of that stuff at once as it changes. And the only people who
need to rebuild all of it from scratch are people like me who are working on
build system scripts.
If libretro-super is going to be the standard reference build environment used
for libretro cores and (perhaps also) players, not only does it need modular
build targets and rules, it needs to be configurable as to what it will do,
and what it will do it to.
The average end user only needs to fetch and build the cores they want. They
might also want those cores installed into their player. That needs to be
possible.
Buildbots need to fetch anything that has changed and then clean, build,
package, and release it. For every supported platform. That needs to be
possible. :)
Developers working on any package (core or player) built using libretro-super
need to be able to run individual commands to perform individual tasks on a
particular package or group of packages. That too needs to be possible.
Finally it is possible somewhere along the line that libretro-super might
itself be packaged and the only people running it out of a git repository will
be those choosing to do so. Everyone else will have it installed somewhere on
their system. The commands need to work outside of the libretro-super
directory, and the build system needs to be able to find anything currently
just tossed into the libretro-super directory if it has been installed onto
your system. I won't say that this needs to be possible because to some
limited extent, it already is. :)
### External sources
This stuff is still a work in progress in my head (even more than compiler
profiles by target), but here we go.
Let's say the [SuperTux](http://supertux.lethargik.org/) project wants to
target libretro. Awesome, right? All they would have to do is publish a link
somewhere. I'll make one up for the purpose of running:
```bash
./libretro-super.sh add-repo http://supertux.lethargik.org/libretro
```
Update the repo list to make sure I have the build rules and I should be able
to just do something like this:
```bash
./libretro-super.sh auto-package supertux/SuperTux
```
This would perform all steps to build a packaged version of SuperTux for my
system, which in this case requires a full fetch, build, and package.
The package likely named ``supertux_libretro_MacOSX-x86_64.zip`` would
contain:
```
supertux_libretro.dylib
supertux_libretro.info
COPYING_v3.txt
README-libretro.txt
```
The file README-libretro.txt would be a simple blurb that this version of the
game is built as a plugin for a libretro player and directs you to the
SuperTux website and to information about what a libretro player is and where
you'd find one.
You'll note I adopt the Windows and frankly everything but CLI UNIX convention
of adding an extension to COPYING. I also chose to give it a version
designation.
## Porting features
Porting features from the iKarith scripts to the standard scripts is fine,
indeed it's welcome. Just keep in mind that while it's possible to do, you
really need to test everything you can if you do. At the very least, make
sure that you test Linux, Windows, and OS X if possible. You might also want
to check with radius as to whether or not your changes will break his
buildbot.
That's about all I can think of for now. This file will see updates as the
concepts contained herein evolve.
<!-- vim: set tw=78 ts=8 sw=8 noet ft=markdown spell: -->

644
iKarith-libretro-build-common.sh Executable file
View File

@ -0,0 +1,644 @@
# vi: ts=3 sw=3 et ft=sh
die() {
echo $1
#exit 1
}
if [ "${CC}" ] && [ "${CXX}" ]; then
COMPILER="CC=\"${CC}\" CXX=\"${CXX}\""
else
COMPILER=""
fi
echo "Compiler: ${COMPILER}"
[[ "${ARM_NEON}" ]] && echo '=== ARM NEON opts enabled... ===' && export FORMAT_COMPILER_TARGET="${FORMAT_COMPILER_TARGET}-neon"
[[ "${CORTEX_A8}" ]] && echo '=== Cortex A8 opts enabled... ===' && export FORMAT_COMPILER_TARGET="${FORMAT_COMPILER_TARGET}-cortexa8"
[[ "${CORTEX_A9}" ]] && echo '=== Cortex A9 opts enabled... ===' && export FORMAT_COMPILER_TARGET="${FORMAT_COMPILER_TARGET}-cortexa9"
[[ "${ARM_HARDFLOAT}" ]] && echo '=== ARM hardfloat ABI enabled... ===' && export FORMAT_COMPILER_TARGET="${FORMAT_COMPILER_TARGET}-hardfloat"
[[ "${ARM_SOFTFLOAT}" ]] && echo '=== ARM softfloat ABI enabled... ===' && export FORMAT_COMPILER_TARGET="${FORMAT_COMPILER_TARGET}-softfloat"
[[ "${X86}" ]] && echo '=== x86 CPU detected... ==='
[[ "${X86}" ]] && [[ "${X86_64}" ]] && echo '=== x86_64 CPU detected... ==='
[[ "${IOS}" ]] && echo '=== iOS =='
echo "${FORMAT_COMPILER_TARGET}"
echo "${FORMAT_COMPILER_TARGET_ALT}"
RESET_FORMAT_COMPILER_TARGET=$FORMAT_COMPILER_TARGET
RESET_FORMAT_COMPILER_TARGET_ALT=$FORMAT_COMPILER_TARGET_ALT
build_summary_log() {
if [ -n "${BUILD_SUMMARY}" ]; then
if [ "${1}" -eq "0" ]; then
echo ${2} >> ${BUILD_SUCCESS}
else
echo ${2} >> ${BUILD_FAIL}
fi
fi
}
check_opengl() {
if [ "${BUILD_LIBRETRO_GL}" ]; then
if [ "${ENABLE_GLES}" ]; then
echo '=== OpenGL ES enabled ==='
export FORMAT_COMPILER_TARGET="${FORMAT_COMPILER_TARGET}-gles"
export FORMAT_COMPILER_TARGET_ALT="${FORMAT_COMPILER_TARGET}"
else
echo '=== OpenGL enabled ==='
export FORMAT_COMPILER_TARGET="${FORMAT_COMPILER_TARGET}-opengl"
export FORMAT_COMPILER_TARGET_ALT="${FORMAT_COMPILER_TARGET}"
fi
else
echo '=== OpenGL disabled in build ==='
fi
}
reset_compiler_targets() {
export FORMAT_COMPILER_TARGET=$RESET_FORMAT_COMPILER_TARGET
export FORMAT_COMPILER_TARGET_ALT=$RESET_FORMAT_COMPILER_TARGET_ALT
}
build_libretro_pcsx_rearmed_interpreter() {
build_dir="${WORKDIR}/libretro-pcsx_rearmed"
if [ -d "${build_dir}" ]; then
echo '=== Building PCSX ReARMed Interpreter ==='
cd "${build_dir}"
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" -f Makefile.libretro platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" clean || die 'Failed to clean PCSX ReARMed'
fi
"${MAKE}" -f Makefile.libretro USE_DYNAREC=0 platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" || die 'Failed to build PCSX ReARMed'
cp "pcsx_rearmed_libretro${FORMAT}.${FORMAT_EXT}" "${RARCH_DIST_DIR}/pcsx_rearmed_interpreter${FORMAT}.${FORMAT_EXT}"
build_summary_log ${?} "pcsx_rearmed_interpreter"
else
echo 'PCSX ReARMed not fetched, skipping ...'
fi
}
# $1 is corename
# $2 is subcorename
# $3 is subdir. In case there is no subdir, enter "." here
# $4 is Makefile name
# $5 is preferred platform
build_libretro_generic_makefile_subcore() {
build_dir="${WORKDIR}/libretro-${1}"
if [ -d "${build_dir}" ]; then
echo "=== Building ${2} ==="
cd "${build_dir}/${3}"
if [ -z "${NOCLEAN}" ]; then
make -f ${4} platform=${5} -j$JOBS clean || die "Failed to clean ${2}"
fi
make -f ${4} platform=${5} -j$JOBS || die "Failed to build ${2}"
cp ${2}_libretro$FORMAT.${FORMAT_EXT} $RARCH_DIST_DIR/${2}_libretro$FORMAT.${FORMAT_EXT}
build_summary_log ${?} ${2}
fi
}
build_libretro_fba_cps2() {
build_libretro_generic_makefile_subcore "fb_alpha" "fba_cores_cps2" "svn-current/trunk/fbacores/cps2" "makefile.libretro" ${FORMAT_COMPILER_TARGET}
}
build_libretro_fba_neogeo() {
build_libretro_generic_makefile_subcore "fb_alpha" "fba_cores_neo" "svn-current/trunk/fbacores/neogeo" "makefile.libretro" ${FORMAT_COMPILER_TARGET}
}
build_libretro_fba_cps1() {
build_libretro_generic_makefile_subcore "fb_alpha" "fba_cores_cps1" "svn-current/trunk/fbacores/cps1" "makefile.libretro" ${FORMAT_COMPILER_TARGET}
}
copy_core_to_dist() {
if [ "$FORMAT_COMPILER_TARGET" = "theos_ios" ]; then
cp "objs/obj/${1}_libretro${FORMAT}.${FORMAT_EXT}" "${RARCH_DIST_DIR}"
build_summary_log ${?} ${1}
else
cp "${1}_libretro${FORMAT}.${FORMAT_EXT}" "${RARCH_DIST_DIR}"
build_summary_log ${?} ${1}
fi
}
# $1 is corename
# $2 is subdir. In case there is no subdir, enter "." here
# $3 is Makefile name
# $4 is preferred platform
build_libretro_generic_makefile() {
build_dir="${WORKDIR}/libretro-${1}"
if [ -d "${build_dir}" ]; then
echo "=== Building ${1} ==="
cd "${build_dir}/${2}"
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" -f ${3} platform="${4}" ${COMPILER} "-j${JOBS}" clean || die "Failed to build ${1}"
fi
echo "${MAKE}" -f ${3} platform="${4}" ${COMPILER} "-j${JOBS}"
"${MAKE}" -f ${3} platform="${4}" ${COMPILER} "-j${JOBS}" || die "Failed to build ${1}"
if [ -z "${5}" ]; then
copy_core_to_dist $1
fi
else
echo "${1} not fetched, skipping ..."
fi
}
build_libretro_stonesoup() {
build_libretro_generic_makefile "stonesoup" "crawl-ref" "Makefile.libretro" ${FORMAT_COMPILER_TARGET}
}
build_libretro_hatari() {
build_libretro_generic_makefile "hatari" "." "Makefile.libretro" ${FORMAT_COMPILER_TARGET}
}
build_libretro_prosystem() {
build_libretro_generic_makefile "prosystem" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_4do() {
build_libretro_generic_makefile "4do" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_o2em() {
build_libretro_generic_makefile "o2em" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_virtualjaguar() {
build_libretro_generic_makefile "virtualjaguar" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_tgbdual() {
build_libretro_generic_makefile "tgbdual" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_nx() {
build_libretro_generic_makefile "nxengine" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_catsfc() {
build_libretro_generic_makefile "catsfc" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_emux() {
build_libretro_generic_makefile "emux" "libretro" "Makefile" ${FORMAT_COMPILER_TARGET} 1
copy_core_to_dist "emux_chip8"
copy_core_to_dist "emux_gb"
copy_core_to_dist "emux_nes"
copy_core_to_dist "emux_sms"
}
build_libretro_picodrive() {
build_libretro_generic_makefile "picodrive" "." "Makefile.libretro" ${FORMAT_COMPILER_TARGET}
}
build_libretro_tyrquake() {
build_libretro_generic_makefile "tyrquake" "." "Makefile.libretro" ${FORMAT_COMPILER_TARGET}
}
build_libretro_2048() {
build_libretro_generic_makefile "2048" "." "Makefile.libretro" ${FORMAT_COMPILER_TARGET}
}
build_libretro_vecx() {
build_libretro_generic_makefile "vecx" "." "Makefile.libretro" ${FORMAT_COMPILER_TARGET}
}
build_libretro_stella() {
build_libretro_generic_makefile "stella" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_bluemsx() {
build_libretro_generic_makefile "bluemsx" "." "Makefile.libretro" ${FORMAT_COMPILER_TARGET}
}
build_libretro_handy() {
build_libretro_generic_makefile "handy" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_fmsx() {
build_libretro_generic_makefile "fmsx" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_gpsp() {
build_libretro_generic_makefile "gpsp" "." "Makefile" ${FORMAT_COMPILER_TARGET_ALT}
}
build_libretro_vba_next() {
build_libretro_generic_makefile "vba_next" "." "Makefile.libretro" ${FORMAT_COMPILER_TARGET_ALT}
}
build_libretro_vbam() {
build_libretro_generic_makefile "vbam" "src/libretro" "Makefile" ${FORMAT_COMPILER_TARGET_ALT}
}
build_libretro_snes9x_next() {
build_libretro_generic_makefile "snes9x_next" "." "Makefile.libretro" ${FORMAT_COMPILER_TARGET_ALT}
}
build_libretro_dinothawr() {
build_libretro_generic_makefile "dinothawr" "." "Makefile" ${FORMAT_COMPILER_TARGET_ALT}
}
build_libretro_genesis_plus_gx() {
build_libretro_generic_makefile "genesis_plus_gx" "." "Makefile.libretro" ${FORMAT_COMPILER_TARGET}
}
build_libretro_mame078() {
build_libretro_generic_makefile "mame078" "." "makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_prboom() {
build_libretro_generic_makefile "prboom" "." "Makefile" ${FORMAT_COMPILER_TARGET_ALT}
}
build_libretro_pcsx_rearmed() {
build_libretro_generic_makefile "pcsx_rearmed" "." "Makefile.libretro" ${FORMAT_COMPILER_TARGET}
}
build_libretro_fceumm() {
build_libretro_generic_makefile "fceumm" "." "Makefile.libretro" ${FORMAT_COMPILER_TARGET}
}
build_libretro_beetle_snes() {
build_libretro_generic_makefile "mednafen_snes" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_beetle_lynx() {
build_libretro_generic_makefile "mednafen_lynx" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_beetle_wswan() {
build_libretro_generic_makefile "mednafen_wswan" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_beetle_gba() {
build_libretro_generic_makefile "mednafen_gba" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_beetle_ngp() {
build_libretro_generic_makefile "mednafen_ngp" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_beetle_pce_fast() {
build_libretro_generic_makefile "mednafen_pce_fast" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_beetle_vb() {
build_libretro_generic_makefile "mednafen_vb" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_beetle_pcfx() {
build_libretro_generic_makefile "mednafen_pcfx" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_beetle_psx() {
build_libretro_generic_makefile "beetle_psx" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_mednafen_psx() {
build_libretro_generic_makefile "mednafen_psx" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_beetle_supergrafx() {
build_libretro_generic_makefile "mednafen_supergrafx" "." "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_meteor() {
build_libretro_generic_makefile "meteor" "libretro" "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_nestopia() {
build_libretro_generic_makefile "nestopia" "libretro" "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_gambatte() {
build_libretro_generic_makefile "gambatte" "libgambatte" "Makefile.libretro" ${FORMAT_COMPILER_TARGET_ALT}
}
build_libretro_yabause() {
build_libretro_generic_makefile "yabause" "libretro" "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_desmume() {
build_libretro_generic_makefile "desmume" "desmume" "Makefile.libretro" ${FORMAT_COMPILER_TARGET}
}
build_libretro_snes9x() {
build_libretro_generic_makefile "snes9x" "libretro" "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_quicknes() {
build_libretro_generic_makefile "quicknes" "libretro" "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_dosbox() {
build_libretro_generic_makefile "dosbox" "." "Makefile.libretro" ${FORMAT_COMPILER_TARGET}
}
build_libretro_fb_alpha() {
build_libretro_generic_makefile "fb_alpha" "svn-current/trunk" "makefile.libretro" ${FORMAT_COMPILER_TARGET}
}
build_libretro_ffmpeg() {
check_opengl
build_libretro_generic_makefile "ffmpeg" "libretro" "Makefile" ${FORMAT_COMPILER_TARGET}
reset_compiler_targets
}
build_libretro_3dengine() {
check_opengl
build_libretro_generic_makefile "3dengine" "." "Makefile" ${FORMAT_COMPILER_TARGET}
reset_compiler_targets
}
build_libretro_scummvm() {
build_libretro_generic_makefile "scummvm" "backends/platform/libretro/build" "Makefile" ${FORMAT_COMPILER_TARGET}
}
build_libretro_ppsspp() {
check_opengl
build_libretro_generic_makefile "ppsspp" "libretro" "Makefile" ${FORMAT_COMPILER_TARGET}
reset_compiler_targets
}
build_libretro_mame() {
build_dir="${WORKDIR}/libretro-mame"
if [ -d "${build_dir}" ]; then
echo ''
echo '=== Building MAME ==='
cd "${build_dir}"
if [ "$IOS" ]; then
echo '=== Building MAME (iOS) ==='
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" -f Makefile.libretro "TARGET=mame" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" clean || die 'Failed to clean MAME'
fi
"${MAKE}" -f Makefile.libretro "TARGET=mame" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "NATIVE=1" buildtools "-j${JOBS}" || die 'Failed to build MAME buildtools'
"${MAKE}" -f Makefile.libretro "TARGET=mame" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} emulator "-j${JOBS}" || die 'Failed to build MAME (iOS)'
elif [ "$X86_64" = "true" ]; then
echo '=== Building MAME64 ==='
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" PTR64=1 -f Makefile.libretro "TARGET=mame" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" clean || die 'Failed to clean MAME'
fi
"${MAKE}" PTR64=1 -f Makefile.libretro "TARGET=mame" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" || die 'Failed to build MAME'
else
echo '=== Building MAME32 ==='
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" -f Makefile.libretro "TARGET=mame" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" clean || die 'Failed to clean MAME'
fi
"${MAKE}" -f Makefile.libretro "TARGET=mame" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" || die 'Failed to build MAME'
fi
cp "mame_libretro${FORMAT}.${FORMAT_EXT}" "${RARCH_DIST_DIR}"
else
echo 'MAME not fetched, skipping ...'
fi
}
build_libretro_mess() {
build_dir="${WORKDIR}/libretro-mame"
if [ -d "${build_dir}" ]; then
echo ''
echo '=== Building MESS ==='
cd "${build_dir}"
if [ "$X86_64" = "true" ]; then
echo '=== Building MESS64 ==='
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" PTR64=1 -f Makefile.libretro "TARGET=mess" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" clean || die 'Failed to clean MAME'
fi
"${MAKE}" PTR64=1 -f Makefile.libretro "TARGET=mess" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" || die 'Failed to build MAME'
else
echo '=== Building MESS32 ==='
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" -f Makefile.libretro "TARGET=mess" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" clean || die 'Failed to clean MAME'
fi
"${MAKE}" -f Makefile.libretro "TARGET=mess" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" || die 'Failed to build MAME'
fi
cp "mess_libretro${FORMAT}.${FORMAT_EXT}" "${RARCH_DIST_DIR}"
build_summary_log ${?} "mess"
else
echo 'MAME not fetched, skipping ...'
fi
}
rebuild_libretro_mess() {
build_dir="${WORKDIR}/libretro-mame"
if [ -d "${build_dir}" ]; then
echo ''
echo '=== Building MESS ==='
cd "${build_dir}"
if [ "$X86_64" = "true" ]; then
echo '=== Building MESS64 ==='
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" PTR64=1 -f Makefile.libretro "TARGET=mess" "PARTIAL=1" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" clean || die 'Failed to clean MAME'
fi
"${MAKE}" PTR64=1 -f Makefile.libretro "TARGET=mess" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" || die 'Failed to build MAME'
else
echo '=== Building MESS32 ==='
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" -f Makefile.libretro "TARGET=mess" "PARTIAL=1" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" clean || die 'Failed to clean MAME'
fi
"${MAKE}" -f Makefile.libretro "TARGET=mess" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" || die 'Failed to build MAME'
fi
cp "mess_libretro${FORMAT}.${FORMAT_EXT}" "${RARCH_DIST_DIR}"
build_summary_log ${?} "mess"
else
echo 'MAME not fetched, skipping ...'
fi
}
build_libretro_ume() {
build_dir="${WORKDIR}/libretro-mame"
if [ -d "${build_dir}" ]; then
echo ''
echo '=== Building UME ==='
cd "${build_dir}"
if [ "$X86_64" = "true" ]; then
echo '=== Building UME64 ==='
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" PTR64=1 -f Makefile.libretro "TARGET=ume" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" clean || die 'Failed to clean MAME'
fi
"${MAKE}" PTR64=1 -f Makefile.libretro "TARGET=ume" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" || die 'Failed to build MAME'
else
echo '=== Building UME32 ==='
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" -f Makefile.libretro "TARGET=ume" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" clean || die 'Failed to clean MAME'
fi
"${MAKE}" -f Makefile.libretro "TARGET=ume" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" || die 'Failed to build MAME'
fi
cp "ume_libretro${FORMAT}.${FORMAT_EXT}" "${RARCH_DIST_DIR}"
build_summary_log ${?} "ume"
else
echo 'MAME not fetched, skipping ...'
fi
}
rebuild_libretro_ume() {
build_dir="${WORKDIR}/libretro-mame"
if [ -d "${build_dir}" ]; then
echo ''
echo '=== Building UME ==='
cd "${build_dir}"
if [ "$X86_64" = "true" ]; then
echo '=== Building UME64 ==='
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" PTR64=1 -f Makefile.libretro "TARGET=ume" "PARTIAL=1" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" clean || die 'Failed to clean MAME'
fi
"${MAKE}" PTR64=1 -f Makefile.libretro "TARGET=ume" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" || die 'Failed to build MAME'
else
echo '=== Building UME32 ==='
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" -f Makefile.libretro "TARGET=ume" "PARTIAL=1" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" clean || die 'Failed to clean MAME'
fi
"${MAKE}" -f Makefile.libretro "TARGET=ume" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}" || die 'Failed to build MAME'
fi
cp "ume_libretro${FORMAT}.${FORMAT_EXT}" "${RARCH_DIST_DIR}"
build_summary_log ${?} "ume"
else
echo 'MAME not fetched, skipping ...'
fi
}
# $1 is corename
# $2 is profile shortname.
# $3 is profile name
# $4 is compiler
build_libretro_bsnes_modern() {
build_dir="${WORKDIR}/libretro-${1}"
if [ -d "${build_dir}" ]; then
echo "=== Building ${1} ${3} ==="
cd ${build_dir}
if [ -z "${NOCLEAN}" ]; then
rm -f obj/*.{o,"${FORMAT_EXT}"}
rm -f out/*.{o,"${FORMAT_EXT}"}
fi
"${MAKE}" -f Makefile platform="${FORMAT_COMPILER_TARGET}" compiler="${4}" ui='target-libretro' profile="${3}" "-j${JOBS}" || die "Failed to build ${1} ${3} core"
cp -f "out/${1}_libretro${FORMAT}.${FORMAT_EXT}" "${RARCH_DIST_DIR}/${1}_${3}_libretro${FORMAT}.${FORMAT_EXT}"
build_summary_log ${?} "${1}_${3}"
else
echo "${1} ${3} not fetched, skipping ..."
fi
}
build_libretro_bsnes() {
build_libretro_bsnes_modern "bsnes" "perf" "performance" ${CXX11}
build_libretro_bsnes_modern "bsnes" "balanced" "balanced" ${CXX11}
build_libretro_bsnes_modern "bsnes" "." "accuracy" ${CXX11}
}
build_libretro_bsnes_mercury() {
build_libretro_bsnes_modern "bsnes_mercury" "perf" "performance" ${CXX11}
build_libretro_bsnes_modern "bsnes_mercury" "balanced" "balanced" ${CXX11}
build_libretro_bsnes_modern "bsnes_mercury" "." "accuracy" ${CXX11}
}
build_libretro_bsnes_cplusplus98() {
CORENAME="bsnes_cplusplus98"
build_dir="${WORKDIR}/libretro-${CORENAME}"
if [ -d "${build_dir}" ]; then
echo "=== Building ${CORENAME} ==="
cd ${build_dir}
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" clean || die "Failed to clean ${CORENAME}"
fi
"${MAKE}" platform="${FORMAT_COMPILER_TARGET}" ${COMPILER} "-j${JOBS}"
cp "out/libretro.${FORMAT_EXT}" "${RARCH_DIST_DIR}/${CORENAME}_libretro${FORMAT}.${FORMAT_EXT}"
build_summary_log ${?} ${CORENAME}
else
echo "${CORENAME} not fetched, skipping ..."
fi
}
build_libretro_bnes() {
build_dir="${WORKDIR}/libretro-bnes"
if [ -d "${build_dir}" ]; then
echo '=== Building bNES ==='
cd ${build_dir}
mkdir -p obj
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" -f Makefile "-j${JOBS}" clean || die 'Failed to clean bNES'
fi
"${MAKE}" -f Makefile ${COMPILER} "-j${JOBS}" compiler="${CXX11}" || die 'Failed to build bNES'
cp "libretro${FORMAT}.${FORMAT_EXT}" "${RARCH_DIST_DIR}/bnes_libretro${FORMAT}.${FORMAT_EXT}"
build_summary_log ${?} "bnes"
else
echo 'bNES not fetched, skipping ...'
fi
}
build_libretro_mupen64() {
check_opengl
build_dir="${WORKDIR}/libretro-mupen64plus"
if [ -d "${build_dir}" ]; then
cd "${build_dir}"
mkdir -p obj
if [ "${X86}" ] && [ "${X86_64}" ]; then
echo '=== Building Mupen 64 Plus (x86_64 dynarec) ==='
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" WITH_DYNAREC='x86_64' platform="${FORMAT_COMPILER_TARGET_ALT}" "-j${JOBS}" clean || die 'Failed to clean Mupen 64 (x86_64 dynarec)'
fi
"${MAKE}" WITH_DYNAREC='x86_64' platform="${FORMAT_COMPILER_TARGET_ALT}" ${COMPILER} "-j${JOBS}" || die 'Failed to build Mupen 64 (x86_64 dynarec)'
elif [ "${X86}" ]; then
echo '=== Building Mupen 64 Plus (x86 32bit dynarec) ==='
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" WITH_DYNAREC='x86' platform="${FORMAT_COMPILER_TARGET_ALT}" "-j${JOBS}" clean || die 'Failed to clean Mupen 64 (x86 dynarec)'
fi
"${MAKE}" WITH_DYNAREC='x86' platform="${FORMAT_COMPILER_TARGET_ALT}" ${COMPILER} "-j${JOBS}" || die 'Failed to build Mupen 64 (x86 dynarec)'
elif [ "${CORTEX_A8}" ] || [ "${CORTEX_A9}" ] || [ "${IOS}" ]; then
echo '=== Building Mupen 64 Plus (ARM dynarec) ==='
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" WITH_DYNAREC='arm' platform="${FORMAT_COMPILER_TARGET_ALT}" "-j${JOBS}" clean || die 'Failed to clean Mupen 64 (ARM dynarec)'
fi
"${MAKE}" WITH_DYNAREC='arm' platform="${FORMAT_COMPILER_TARGET_ALT}" ${COMPILER} "-j${JOBS}" || die 'Failed to build Mupen 64 (ARM dynarec)'
else
echo '=== Building Mupen 64 Plus ==='
if [ -z "${NOCLEAN}" ]; then
"${MAKE}" "-j${JOBS}" clean || die 'Failed to clean Mupen 64'
fi
"${MAKE}" platform="${FORMAT_COMPILER_TARGET_ALT}" ${COMPILER} "-j${JOBS}" || die 'Failed to build Mupen 64'
fi
cp "mupen64plus_libretro${FORMAT}.${FORMAT_EXT}" "${RARCH_DIST_DIR}"
build_summary_log ${?} "mupen64plus"
else
echo 'Mupen64 Plus not fetched, skipping ...'
fi
reset_compiler_targets
}
build_summary() {
if [ -z "${NOBUILD_SUMMARY}" ]; then
echo "=== Core Build Summary ===" > ${BUILD_SUMMARY}
if [ -r "${BUILD_SUCCESS}" ]; then
echo "`wc -l < ${BUILD_SUCCESS}` core(s) successfully built:" >> ${BUILD_SUMMARY}
${BUILD_SUMMARY_FMT} ${BUILD_SUCCESS} >> ${BUILD_SUMMARY}
else
echo " 0 cores successfully built. :(" >> ${BUILD_SUMMARY}
echo "`wc -l < ${BUILD_FAIL}` core(s) failed to build:"
fi
if [ -r "${BUILD_FAIL}" ]; then
echo "`wc -l < ${BUILD_FAIL}` core(s) failed to build:" >> ${BUILD_SUMMARY}
${BUILD_SUMMARY_FMT} ${BUILD_FAIL} >> ${BUILD_SUMMARY}
else
echo " 0 cores failed to build! :D" >> ${BUILD_SUMMARY}
fi
rm -f $BUILD_SUCCESS $BUILD_FAIL
cat ${BUILD_SUMMARY}
fi
}
create_dist_dir() {
if [ -d "${RARCH_DIST_DIR}" ]; then
echo "Directory ${RARCH_DIST_DIR} already exists, skipping creation..."
else
mkdir -p "${RARCH_DIST_DIR}"
fi
}
create_dist_dir

161
iKarith-libretro-build.sh Executable file
View File

@ -0,0 +1,161 @@
#! /bin/bash
# vi: sw=3 ts=3 et
# 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"`"
BASE_DIR="`dirname "${SCRIPT}"`"
WORKDIR="`pwd`"
. ${BASE_DIR}/iKarith-libretro-config.sh
if [ -z "$RARCH_DIST_DIR" ]; then
RARCH_DIR="${WORKDIR}/dist"
RARCH_DIST_DIR="$RARCH_DIR/$DIST_DIR"
fi
if [ -z "$JOBS" ]; then
JOBS=7
fi
die()
{
echo $1
#exit 1
}
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
FORMAT_COMPILER_TARGET_ALT=$FORMAT_COMPILER_TARGET
echo "CC = $CC"
echo "CXX = $CXX"
echo "STRIP = $STRIP"
. ${BASE_DIR}/iKarith-libretro-build-common.sh
mkdir -p "$RARCH_DIST_DIR"
if [ -n "${1}" ]; then
NOBUILD_SUMMARY=1
while [ -n "${1}" ]; do
"${1}"
shift
done
else
build_libretro_2048
build_libretro_4do
build_libretro_bluemsx
build_libretro_fmsx
build_libretro_bsnes_cplusplus98
build_libretro_bsnes
build_libretro_bsnes_mercury
build_libretro_beetle_lynx
build_libretro_beetle_gba
build_libretro_beetle_ngp
build_libretro_beetle_pce_fast
build_libretro_beetle_supergrafx
build_libretro_beetle_pcfx
build_libretro_beetle_vb
build_libretro_beetle_wswan
build_libretro_mednafen_psx
build_libretro_beetle_snes
build_libretro_catsfc
build_libretro_snes9x
build_libretro_snes9x_next
build_libretro_genesis_plus_gx
build_libretro_fb_alpha
build_libretro_vbam
build_libretro_vba_next
build_libretro_bnes
build_libretro_fceumm
build_libretro_gambatte
build_libretro_meteor
build_libretro_nx
build_libretro_prboom
build_libretro_stella
build_libretro_quicknes
build_libretro_nestopia
build_libretro_tyrquake
build_libretro_mame078
build_libretro_mame
build_libretro_dosbox
build_libretro_scummvm
build_libretro_picodrive
build_libretro_handy
build_libretro_desmume
if [ $FORMAT_COMPILER_TARGET != "win" ]; then
build_libretro_pcsx_rearmed
fi
build_libretro_yabause
build_libretro_vecx
build_libretro_tgbdual
build_libretro_prosystem
build_libretro_dinothawr
build_libretro_virtualjaguar
build_libretro_mupen64
build_libretro_ffmpeg
build_libretro_3dengine
build_libretro_ppsspp
build_libretro_o2em
build_libretro_hatari
build_libretro_gpsp
build_libretro_emux
build_summary
fi

222
iKarith-libretro-config.sh Executable file
View File

@ -0,0 +1,222 @@
#!/bin/bash
# vi: ts=3 sw=3 et
# Architecture Assignment
config_cpu() {
[ -n "${2}" ] && ARCH=${1}
[ -z "${ARCH}" ] && ARCH="`uname -m`"
case "${ARCH}" in
x86_64)
X86=true
X86_64=true
;;
i386|i686)
X86=true
;;
armv*)
ARM=true
export FORMAT_COMPILER_TARGET=armv
export RARCHCFLAGS="${RARCHCFLAGS} -marm"
case "${ARCH}" in
armv5tel) ARMV5=true ;;
armv6l) ARMV6=true ;;
armv7l) ARMV7=true ;;
esac
;;
esac
if [ -n "${PROCESSOR_ARCHITEW6432}" -a "${PROCESSOR_ARCHITEW6432}" = "AMD64" ]; then
ARCH=x86_64
X86=true && X86_64=true
fi
}
# Platform Assignment
config_platform() {
[ -n "${1}" ] && platform="${1}"
[ -z "${platform}" ] && platform="`uname`"
case "${platform}" in
*BSD*)
FORMAT_EXT="so"
FORMAT_COMPILER_TARGET="unix"
DIST_DIR="bsd"
;;
osx|*Darwin*)
FORMAT_EXT="dylib"
FORMAT_COMPILER_TARGET="osx"
DIST_DIR="osx"
;;
win|*mingw32*|*MINGW32*|*MSYS_NT*)
FORMAT_EXT="dll"
FORMAT_COMPILER_TARGET="win"
DIST_DIR="win_x86"
;;
win64|*mingw64*|*MINGW64*)
FORMAT_EXT="dll"
FORMAT_COMPILER_TARGET="win"
DIST_DIR="win_x64"
;;
*psp1*)
FORMAT_EXT="a"
FORMAT_COMPILER_TARGET="psp1"
DIST_DIR="psp1"
;;
*ios|theos_ios*)
FORMAT_EXT="dylib"
FORMAT_COMPILER_TARGET="theos_ios"
DIST_DIR="theos"
;;
android)
FORMAT_EXT="so"
FORMAT_COMPILER_TARGET="android"
DIST_DIR="android"
;;
*android-armv7*)
FORMAT_EXT="so"
FORMAT_COMPILER_TARGET="android-armv7"
DIST_DIR="android/armeabi-v7a"
;;
*)
FORMAT_EXT="so"
FORMAT_COMPILER_TARGET="unix"
DIST_DIR="unix"
;;
esac
export FORMAT_COMPILER_TARGET_ALT="$FORMAT_COMPILER_TARGET"
}
config_log_build_host() {
echo "PLATFORM: ${platform}"
echo "ARCHITECTURE: ${ARCH}"
echo "TARGET: ${FORMAT_COMPILER_TARGET}"
}
config_cpu
config_platform
config_log_build_host
if [ -z "${JOBS}" ]; then
if command -v nproc >/dev/null; then
JOBS=`nproc`
else
JOBS=1
fi
fi
#if uncommented, will fetch repos with read+write access. Useful for committers
#export WRITERIGHTS=1
#if uncommented, will build experimental cores as well which are not yet fit for release.
#export BUILD_EXPERIMENTAL=1
#ARM DEFINES
#===========
#if uncommented, will build cores with Cortex A8 compiler optimizations
#export CORTEX_A8=1
#if uncommented, will build cores with Cortex A9 compiler optimizations
#export CORTEX_A9=1
#if uncommented, will build cores with ARM hardfloat ABI
#export ARM_HARDFLOAT=1
#if uncommented, will build cores with ARM softfloat ABI
#export ARM_SOFTFLOAT=1
#if uncommented, will build cores with ARM NEON support (ARMv7+ only)
#export ARM_NEON=1
#OPENGL DEFINES
#==============
#if uncommented, will build libretro GL cores. Ignored for mobile platforms - GL cores will always be built there.
export BUILD_LIBRETRO_GL=1
#if uncommented, will build cores with OpenGL ES 2 support. Not needed
#for platform-specific cores - only for generic core builds (ie. libretro-build.sh)
#export ENABLE_GLES=1
#ANDROID DEFINES
#================
export TARGET_ABIS="armeabi armeabi-v7a x86"
#uncomment to define NDK standalone toolchain for ARM
#export NDK_ROOT_DIR_ARM =
#uncomment to define NDK standalone toolchain for MIPS
#export NDK_ROOT_DIR_MIPS =
#uncomment to define NDK standalone toolchain for x86
#export NDK_ROOT_DIR_X86 =
# android version target if GLES is in use
export NDK_GL_HEADER_VER=android-18
# android version target if GLES is not in use
export NDK_NO_GL_HEADER_VER=android-9
# Retroarch target android API level
export RA_ANDROID_API=android-18
# Retroarch minimum API level (defines low end android version compatability)
export RA_ANDROID_MIN_API=android-9
#OSX DEFINES
#===========
# Define this to skip the universal build
# export NOUNIVERSAL=1
# ARCHFLAGS is a very convenient way of doing this for simple/obvious cores
# that don't need anything defined on the command line for 32 vs 64 bit
# systems, however it won't work for anything that does. For that, you need
# to do two separate builds, one for each arch, and then do something like:
# lipo -create core_i386.dylib core_x86_64.dylib -output core_ub.dylib
#
# If building on 10.5/10.6, it's possible that you could actually build a UB
# for Intel/PowerPC, but please don't. ;) Consider this a proof of concept
# for now just to test a few cores.
if [[ "${FORMAT_COMPILER_TARGET}" = "osx" && -z "${NOUNIVERSAL}" ]]; then
case "${ARCH}" in
i385|x86_64)
export ARCHFLAGS="-arch i386 -arch x86_64"
;;
ppc|ppc64)
export ARCHFLAGS="-arch ppc -arch ppc64"
;;
*)
echo "Universal build requested with unknown ARCH=\"${ARCH}\""
esac
fi
#CORE BUILD SUMMARY
#==================
# Remove this to enable the core build summary
export BUILD_SUMMARY=1
BUILD_SUMMARY=${WORKDIR}/build-summary.log
BUILD_SUCCESS=${WORKDIR}/build-success.log
BUILD_FAIL=${WORKDIR}/build-fail.log
if [ -z "${BUILD_SUMMARY_FMT}" ]; then
if command -v column >/dev/null; then
BUILD_SUMMARY_FMT=column
else
BUILD_SUMMARY_FMT=cat
fi
fi
#USER DEFINES
#------------
#These options should be defined inside your own
#local libretro-config-user.sh file rather than here.
#The following below is just a sample.
if [ -f "${WORKDIR}/libretro-config-user.sh" ]; then
. ${WORKDIR}/libretro-config-user.sh
fi

399
iKarith-libretro-fetch.sh Executable file
View File

@ -0,0 +1,399 @@
#! /bin/bash
# vi: sw=3 ts=3 noet
# 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"`"
BASE_DIR="`dirname "$SCRIPT"`"
. $BASE_DIR/iKarith-libretro-config.sh
WORKDIR=$(pwd)
echo_cmd() {
echo "$@"
"$@"
}
# fetch_git <repository> <local directory>
# Clones or pulls updates from a git repository into a local directory
#
# $1 The URI to fetch
# $2 The local directory to fetch to (relative)
# $3 Set to clone --recursive
# $4 Set to pull --recursive
fetch_git() {
fetch_dir="$WORKDIR/$2"
echo "=== Fetching $2 ==="
if [ -d "$fetch_dir/.git" ]; then
echo_cmd git -C "$fetch_dir" pull
if [ -n "$4" ]; then
echo_cmd git -C "$fetch_dir" submodule foreach git pull origin master
fi
else
echo_cmd git clone "$1" "$fetch_dir"
if [ -n "$3" ]; then
echo_cmd git -C "$fetch_dir" submodule update --init
fi
fi
}
# Keep three copies so we don't have to rebuild stuff all the time.
# FIXME: If you need 3 copies of source to compile 3 sets of objects, you're
# doing it wrong. We should fix this.
fetch_project_bsnes()
{
fetch_git "${1}" "${2}"
fetch_git "${WORKDIR}/${2}" "${2}/perf"
fetch_git "${WORKDIR}/${2}" "${2}/balanced"
}
fetch_retroarch() {
fetch_git "https://github.com/libretro/RetroArch.git" "retroarch"
fetch_git "https://github.com/libretro/common-shaders.git" "retroarch/media/shaders_cg"
fetch_git "https://github.com/libretro/common-overlays.git" "retroarch/media/overlays"
fetch_git "https://github.com/libretro/retroarch-assets.git" "retroarch/media/assets"
fetch_git "https://github.com/libretro/retroarch-joypad-autoconfig.git" "retroarch/media/autoconfig"
fetch_git "https://github.com/libretro/libretro-database.git" "retroarch/media/libretrodb"
}
fetch_tools() {
fetch_git "https://github.com/libretro/libretro-manifest.git" "libretro-manifest"
fetch_git "https://github.com/libretro/libretrodb.git" "libretrodb"
fetch_git "https://github.com/libretro/libretro-dat-pull.git" "libretro-dat-pull"
}
fetch_libretro_bsnes() {
fetch_project_bsnes "https://github.com/libretro/bsnes-libretro.git" "libretro-bsnes"
}
fetch_libretro_snes9x() {
fetch_git "https://github.com/libretro/snes9x.git" "libretro-snes9x"
}
fetch_libretro_snes9x_next() {
fetch_git "https://github.com/libretro/snes9x-next.git" "libretro-snes9x_next"
}
fetch_libretro_genesis_plus_gx() {
fetch_git "https://github.com/libretro/Genesis-Plus-GX.git" "libretro-genesis_plus_gx"
}
fetch_libretro_fb_alpha() {
fetch_git "https://github.com/libretro/fba-libretro.git" "libretro-fb_alpha"
}
fetch_libretro_vba_next() {
fetch_git "https://github.com/libretro/vba-next.git" "libretro-vba_next"
}
fetch_libretro_vbam() {
fetch_git "https://github.com/libretro/vbam-libretro.git" "libretro-vbam"
}
fetch_libretro_handy() {
fetch_git "https://github.com/libretro/libretro-handy.git" "libretro-handy"
}
fetch_libretro_bnes() {
fetch_git "https://github.com/libretro/bnes-libretro.git" "libretro-bnes"
}
fetch_libretro_fceumm() {
fetch_git "https://github.com/libretro/libretro-fceumm.git" "libretro-fceumm"
}
fetch_libretro_gambatte() {
fetch_git "https://github.com/libretro/gambatte-libretro.git" "libretro-gambatte"
}
fetch_libretro_meteor() {
fetch_git "https://github.com/libretro/meteor-libretro.git" "libretro-meteor"
}
fetch_libretro_nxengine() {
fetch_git "https://github.com/libretro/nxengine-libretro.git" "libretro-nxengine"
}
fetch_libretro_prboom() {
fetch_git "https://github.com/libretro/libretro-prboom.git" "libretro-prboom"
}
fetch_libretro_stella() {
fetch_git "https://github.com/libretro/stella-libretro.git" "libretro-stella"
}
fetch_libretro_desmume() {
fetch_git "https://github.com/libretro/desmume.git" "libretro-desmume"
}
fetch_libretro_quicknes() {
fetch_git "https://github.com/libretro/QuickNES_Core.git" "libretro-quicknes"
}
fetch_libretro_nestopia() {
fetch_git "https://github.com/libretro/nestopia.git" "libretro-nestopia"
}
fetch_libretro_tyrquake() {
fetch_git "https://github.com/libretro/tyrquake.git" "libretro-tyrquake"
}
fetch_libretro_pcsx_rearmed() {
fetch_git "https://github.com/libretro/pcsx_rearmed.git" "libretro-pcsx_rearmed"
}
fetch_libretro_mednafen_gba() {
fetch_git "https://github.com/libretro/beetle-gba-libretro.git" "libretro-mednafen_gba"
}
fetch_libretro_mednafen_lynx() {
fetch_git "https://github.com/libretro/beetle-lynx-libretro.git" "libretro-mednafen_lynx"
}
fetch_libretro_mednafen_ngp() {
fetch_git "https://github.com/libretro/beetle-ngp-libretro.git" "libretro-mednafen_ngp"
}
fetch_libretro_mednafen_pce_fast() {
fetch_git "https://github.com/libretro/beetle-pce-fast-libretro.git" "libretro-mednafen_pce_fast"
}
fetch_libretro_mednafen_supergrafx() {
fetch_git "https://github.com/libretro/beetle-supergrafx-libretro.git" "libretro-mednafen_supergrafx"
}
fetch_libretro_mednafen_psx() {
fetch_git "https://github.com/libretro/mednafen-psx-libretro.git" "libretro-mednafen_psx"
}
fetch_libretro_mednafen_pcfx() {
fetch_git "https://github.com/libretro/beetle-pcfx-libretro.git" "libretro-mednafen_pcfx"
}
fetch_libretro_mednafen_snes() {
fetch_git "https://github.com/libretro/beetle-bsnes-libretro.git" "libretro-mednafen_snes"
}
fetch_libretro_mednafen_vb() {
fetch_git "https://github.com/libretro/beetle-vb-libretro.git" "libretro-mednafen_vb"
}
fetch_libretro_mednafen_wswan() {
fetch_git "https://github.com/libretro/beetle-wswan-libretro.git" "libretro-mednafen_wswan"
}
fetch_libretro_scummvm() {
fetch_git "https://github.com/libretro/scummvm.git" "libretro-scummvm"
}
fetch_libretro_yabause() {
fetch_git "https://github.com/libretro/yabause.git" "libretro-yabause"
}
fetch_libretro_dosbox() {
fetch_git "https://github.com/libretro/dosbox-libretro.git" "libretro-dosbox"
}
fetch_libretro_virtualjaguar() {
fetch_git "https://github.com/libretro/virtualjaguar-libretro.git" "libretro-virtualjaguar"
}
fetch_libretro_mame078() {
fetch_git "https://github.com/libretro/mame2003-libretro.git" "libretro-mame078"
}
fetch_libretro_mame139() {
fetch_git "https://github.com/libretro/mame2010-libretro.git" "libretro-mame139"
}
fetch_libretro_mame() {
fetch_git "https://github.com/libretro/mame.git" "libretro-mame"
}
fetch_libretro_ffmpeg() {
fetch_git "https://github.com/libretro/FFmpeg.git" "libretro-ffmpeg"
}
fetch_libretro_bsnes_cplusplus98() {
fetch_git "https://github.com/libretro/bsnes-libretro-cplusplus98.git" "libretro-bsnes_cplusplus98"
}
fetch_libretro_bsnes_mercury() {
fetch_git "https://github.com/libretro/bsnes-mercury.git" "libretro-bsnes_mercury"
}
fetch_libretro_picodrive() {
fetch_git "https://github.com/libretro/picodrive.git" "libretro-picodrive" "1" "1"
}
fetch_libretro_tgbdual() {
fetch_git "https://github.com/libretro/tgbdual-libretro.git" "libretro-tgbdual"
}
fetch_libretro_mupen64plus() {
fetch_git "https://github.com/libretro/mupen64plus-libretro.git" "libretro-mupen64plus"
}
fetch_libretro_dinothawr() {
fetch_git "https://github.com/libretro/Dinothawr.git" "libretro-dinothawr"
}
fetch_libretro_uae() {
fetch_git "https://github.com/libretro/libretro-uae.git" "libretro-uae"
}
fetch_libretro_3dengine() {
fetch_git "https://github.com/libretro/libretro-3dengine.git" "libretro-3dengine"
}
fetch_libretro_remotejoy() {
fetch_git "https://github.com/libretro/libretro-remotejoy.git" "libretro-remotejoy"
}
fetch_libretro_bluemsx() {
fetch_git "https://github.com/libretro/blueMSX-libretro.git" "libretro-bluemsx"
}
fetch_libretro_fmsx() {
fetch_git "https://github.com/libretro/fmsx-libretro.git" "libretro-fmsx"
}
fetch_libretro_2048() {
fetch_git "https://github.com/libretro/libretro-2048.git" "libretro-2048"
}
fetch_libretro_vecx() {
fetch_git "https://github.com/libretro/libretro-vecx.git" "libretro-vecx"
}
fetch_libretro_ppsspp() {
fetch_git "https://github.com/libretro/ppsspp.git" "libretro-ppsspp" "1" "1"
}
fetch_libretro_prosystem() {
fetch_git "https://github.com/libretro/prosystem-libretro.git" "libretro-prosystem"
}
fetch_libretro_o2em() {
fetch_git "https://github.com/libretro/libretro-o2em.git" "libretro-o2em"
}
fetch_libretro_4do() {
fetch_git "https://github.com/libretro/4do-libretro.git" "libretro-4do"
}
fetch_libretro_catsfc() {
fetch_git "https://github.com/libretro/CATSFC-libretro.git" "libretro-catsfc"
}
fetch_libretro_stonesoup() {
fetch_git "https://github.com/libretro/crawl-ref.git" "libretro-stonesoup" "1" ""
}
fetch_libretro_hatari() {
fetch_git "https://github.com/libretro/hatari.git" "libretro-hatari"
}
fetch_libretro_tempgba() {
fetch_git "https://github.com/libretro/TempGBA-libretro.git" "libretro-tempgba"
}
fetch_libretro_gpsp() {
fetch_git "https://github.com/libretro/gpsp.git" "libretro-gpsp"
}
fetch_libretro_emux() {
fetch_git "https://github.com/libretro/emux.git" "libretro-emux"
}
if [ -n "${1}" ]; then
while [ -n "${1}" ]; do
"${1}"
shift
done
else
fetch_retroarch
fetch_tools
fetch_libretro_bsnes
fetch_libretro_snes9x
fetch_libretro_snes9x_next
fetch_libretro_genesis_plus_gx
fetch_libretro_fb_alpha
fetch_libretro_vba_next
fetch_libretro_vbam
fetch_libretro_handy
fetch_libretro_bnes
fetch_libretro_fceumm
fetch_libretro_gambatte
fetch_libretro_meteor
fetch_libretro_nxengine
fetch_libretro_prboom
fetch_libretro_stella
fetch_libretro_desmume
fetch_libretro_quicknes
fetch_libretro_nestopia
fetch_libretro_tyrquake
fetch_libretro_pcsx_rearmed
fetch_libretro_mednafen_gba
fetch_libretro_mednafen_lynx
fetch_libretro_mednafen_ngp
fetch_libretro_mednafen_pce_fast
fetch_libretro_mednafen_supergrafx
fetch_libretro_mednafen_psx
fetch_libretro_mednafen_pcfx
fetch_libretro_mednafen_snes
fetch_libretro_mednafen_vb
fetch_libretro_mednafen_wswan
fetch_libretro_scummvm
fetch_libretro_yabause
fetch_libretro_dosbox
fetch_libretro_virtualjaguar
fetch_libretro_mame078
fetch_libretro_mame139
fetch_libretro_mame
fetch_libretro_ffmpeg
fetch_libretro_bsnes_cplusplus98
fetch_libretro_bsnes_mercury
fetch_libretro_picodrive
fetch_libretro_tgbdual
fetch_libretro_mupen64plus
fetch_libretro_dinothawr
fetch_libretro_uae
fetch_libretro_3dengine
fetch_libretro_remotejoy
fetch_libretro_bluemsx
fetch_libretro_fmsx
fetch_libretro_2048
fetch_libretro_vecx
fetch_libretro_ppsspp
fetch_libretro_prosystem
fetch_libretro_o2em
fetch_libretro_4do
fetch_libretro_catsfc
fetch_libretro_stonesoup
fetch_libretro_hatari
fetch_libretro_tempgba
fetch_libretro_gpsp
fetch_libretro_emux
fi

137
iKarith-retroarch-build.sh Executable file
View File

@ -0,0 +1,137 @@
#!/bin/bash
. ./iKarith-libretro-config.sh
# 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
die()
{
echo $1
#exit 1
}
if [ "$HOST_CC" ]; then
CC="${HOST_CC}-gcc"
CXX="${HOST_CC}-g++"
STRIP="${HOST_CC}-strip"
fi
if [ -z "$MAKE" ]; then
if [ "$(expr substr $(uname -s) 1 7)" = "MINGW32" ]; then
MAKE=mingw32-make
else
MAKE=make
fi
fi
if [ -z "$CC" ]; then
if [ $FORMAT_COMPILER_TARGET = "osx" ]; then
CC=clang
elif [ "$(expr substr $(uname -s) 1 7)" = "MINGW32" ]; then
CC=mingw32-gcc
else
CC=gcc
fi
fi
if [ -z "$CXX" ]; then
if [ $FORMAT_COMPILER_TARGET = "osx" ]; then
CXX=clang++
elif [ "$(expr substr $(uname -s) 1 7)" = "MINGW32" ]; then
CXX=mingw32-g++
else
CXX=g++
fi
fi
echo "CC = $CC"
echo "CXX = $CXX"
echo "STRIP = $STRIP"
mkdir -p "$RARCH_DIST_DIR"
export RARCHCFLAGS=""
check_deps()
{
if [ $ENABLE_GLES ]; then
echo "=== Enabling OpenGL ES ==="
export ENABLE_GLES="--enable-gles"
fi
if [ $ARM_NEON ]; then
echo "=== Enabling ARM NEON support ==="
export ENABLE_NEON="--enable-neon"
fi
if [ $ARM_HARDFLOAT ]; then
echo "=== Enabling ARM Hard float ABI support ==="
export RARCHCFLAGS="${RARCHCFLAGS} -mfloat-abi=hard"
fi
if [ $ARM_SOFTFLOAT ]; then
echo "=== Enabling ARM Soft float ABI support ==="
export RARCHCFLAGS="${RARCHCFLAGS} -mfloat-abi=softfp"
fi
if [ "$CORTEX_A8" ]; then
echo "=== Enabling Cortex A8 CFLAGS ==="
export RARCHCFLAGS="${RARCHCFLAGS} -mcpu=cortex-a8 -mtune=cortex-a8"
fi
if [ "$CORTEX_A9" ]; then
echo "=== Enabling Cortex A9 CFLAGS ==="
export RARCHCFLAGS="${RARCHCFLAGS} -mcpu=cortex-a9 -mtune=cortex-a9"
fi
if [ $ARM_NEON ]; then
echo "=== Enabling ARM NEON support (CFLAGS) ==="
export RARCHCFLAGS="${RARCHCFLAGS} -mfpu=neon"
fi
}
build_retroarch()
{
cd "$BASE_DIR"
pwd
if [ -d "retroarch" ]; then
echo "=== Building RetroArch ==="
cd retroarch
check_deps
if [ -z "${NOCLEAN}" ]; then
./configure $ENABLE_GLES $ENABLE_NEON
${MAKE} -f Makefile platform=${FORMAT_COMPILER_TARGET} CC="gcc ${RARCHCFLAGS}" $COMPILER -j$JOBS clean || die "Failed to clean RetroArch"
fi
${MAKE} -f Makefile platform=${FORMAT_COMPILER_TARGET} CC="gcc ${RARCHCFLAGS}" $COMPILER -j$JOBS || die "Failed to build RetroArch"
else
echo "RetroArch not fetched, skipping ..."
fi
}
if [ $1 ]; then
$1
else
build_retroarch
fi