Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
SquirrelJME
Commits
3391fd33
Commit
3391fd33
authored
May 15, 2022
by
Stephanie Gawroriski
Browse files
Add kludge to allow building on Termux.
parent
9526c64a
Pipeline
#108746
passed with stages
in 1 minute and 22 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
emulators/emulator-base/build.gradle
View file @
3391fd33
...
...
@@ -10,6 +10,17 @@ description = "This library provides the base support for testing and " +
"running SquirrelJME on a Java SE host, which is normally not "
+
"capable of doing as such."
// If running on Termux on Android, we need to do some changes accordingly
// so that the C compiler is found and things link... We technically are not
// on x86_64 but it really does not matter anyway as long as it passes
// -m64 correctly when on Android.
if
(
project
.
hasProperty
(
"squirreljmeTermuxCompiler"
)
&&
project
.
squirreljmeTermuxCompiler
)
{
library
{
targetMachines
.
add
(
machines
.
linux
.
x86_64
)
}
}
// Although it would be useful to use Java 8, we have to stay on Java 7
// because SquirrelJME is a Java 7 VM.
compileJava
...
...
settings.gradle
View file @
3391fd33
...
...
@@ -3,6 +3,36 @@ import java.nio.file.Files
import
java.util.regex.Pattern
import
java.util.stream.Collectors
// Poking PATH is used by multiple systems
def
envRawPathProperty
=
System
.
getenv
(
"PATH"
)
def
envPath
=
(
envRawPathProperty
!=
null
?
Arrays
.
asList
(
envRawPathProperty
.
split
(
Pattern
.
quote
(
File
.
pathSeparator
)))
.
stream
().<
java
.
nio
.
file
.
Path
>
map
({
it
->
Paths
.
get
(
it
)})
.
collect
(
Collectors
.
toList
())
:
Collections
.<
java
.
nio
.
file
.
Path
>
emptyList
())
// Do we have Termux in our PATH?
def
foundTermuxRoot
=
false
for
(
java
.
nio
.
file
.
Path
path
:
envPath
)
{
def
fullPath
=
path
.
toAbsolutePath
();
if
(
fullPath
.
toString
().
startsWith
(
"/data/data/com.termux/"
))
{
foundTermuxRoot
=
true
;
}
}
// Did we find Termux in our PATH?
if
((
foundTermuxRoot
&&
System
.
getProperty
(
"force.termux"
)
==
null
)
||
Boolean
.
getBoolean
(
"force.termux"
))
{
// squirreljmeTermuxCompiler
logger
.
lifecycle
(
"Appears we are in Termux, kludging compiler build..."
)
// Enable it
gradle
.
beforeProject
({
proj
->
proj
.
ext
.
squirreljmeTermuxCompiler
=
true
})
}
// If we have a really high Java version being used then the parameters
// for -source and -target were likely removed, so as such we cannot rely on
// the project being able to be built in such versions.
...
...
@@ -13,15 +43,7 @@ if (JavaVersion.current() >= JavaVersion.VERSION_HIGHER ||
"if Eclipse Java Compiler (ECJ) exists on the system "
+
"then it will be used to compile the modules instead."
)
// Fallback to ECJ on newer Java versions, if available
def
envRawPathProperty
=
System
.
getenv
(
"PATH"
)
def
envPath
=
(
envRawPathProperty
!=
null
?
Arrays
.
asList
(
envRawPathProperty
.
split
(
Pattern
.
quote
(
File
.
pathSeparator
)))
.
stream
().<
java
.
nio
.
file
.
Path
>
map
({
it
->
Paths
.
get
(
it
)})
.
collect
(
Collectors
.
toList
())
:
null
)
// Does ECJ exist in the class path?
// Does ECJ exist in the system PATH?
def
foundEcjBinary
=
false
for
(
java
.
nio
.
file
.
Path
path
:
envPath
)
{
if
(
Files
.
exists
(
path
.
resolve
(
"ecj"
)))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment