Skip to content

Commit

Permalink
android: query sysroot in ENABLE_STANDALONE=1
Browse files Browse the repository at this point in the history
Running a standalone version of fbc to build with
android ndk is not recommended, but if we are,
try and query the sysroot.

If we explicitly passed in -sysroot to fbc, then
go ahead try to query gcc for the needed library
even if we aren't targeting android.

Otherwise, if we are running standalone fbc and not
targeting android and didn't pass in a -sysroot,
just return the computed library file name as was
done previously in fbc.
  • Loading branch information
jayrm committed Jan 6, 2024
1 parent 3cfefa6 commit 4be3b8e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Expand Up @@ -32,6 +32,7 @@ Version 1.20.0
- "-fpu neon" option for ARM archs (passed through to gcc).
- -pic option (position-independent code) is now allowed on x86 (where it forces -gen gcc) and when building executables (in which case it passes -pie option to ld to produce position independent executables)
- fbc: add '-sysroot <path>' command line option to specify the sysroot, needed by some cross-compiling toolchains
- fbc: in fbc standalone version query gcc for library names when targetting android or -sysroot was passed explicitly to fbc

[fixed]
- github #410: give consistent floating point comparisons results involving NaNs.
Expand Down
16 changes: 14 additions & 2 deletions src/compiler/fbc.bas
Expand Up @@ -367,7 +367,20 @@ private function fbcBuildPathToLibFile( byval file as zstring ptr ) as string

found = fbc.libpath + FB_HOST_PATHDIV + *file

#ifndef ENABLE_STANDALONE
#ifdef ENABLE_STANDALONE
'' running a standalone version of fbc to build with android
'' ndk is not recommended, but if we are, try and query the
'' sysroot if it wasn't already supplied. Otherwise
'' if with are running a standalone fbc, just return the
'' computed library file name if we didn't explicitly pass
'' in a -sysroot
if( fbGetOption( FB_COMPOPT_TARGET ) <> FB_COMPTARGET_ANDROID ) then
if( len( fbc.sysroot ) = 0 ) then
return found
end if
end if
#endif

'' Does it exist in our lib/?
if( hFileExists( found ) ) then
'' Overrides anything else
Expand Down Expand Up @@ -403,7 +416,6 @@ private function fbcBuildPathToLibFile( byval file as zstring ptr ) as string
if( found = hStripPath( found ) ) then
exit function
end if
#endif

function = found
end function
Expand Down

0 comments on commit 4be3b8e

Please sign in to comment.