Move tricky compiler options over to build.sh
All of these are options that are specific to our ghactions builds and not something we want downstream and package maintainers to be locked into using.
This commit is contained in:
parent
304cc3a47b
commit
a8d2b269b1
54
.github/build.sh
vendored
54
.github/build.sh
vendored
@ -138,24 +138,32 @@ if [[ -d build ]]; then
|
||||
rm -r build
|
||||
fi
|
||||
|
||||
c_args=
|
||||
c_link_args=
|
||||
if [[ $BSH_HOST_PLATFORM-$BSH_HOST_LIBC != windows-msvc ]]; then
|
||||
c_args+=\'-ffunction-sections\',
|
||||
c_args+=\'-fdata-sections\',
|
||||
if [[ $BSH_HOST_PLATFORM == darwin ]]; then
|
||||
c_link_args+=\'-Wl,-dead_strip\',
|
||||
else
|
||||
c_link_args+=\'-Wl,--gc-sections\',
|
||||
fi
|
||||
fi
|
||||
if [[ $BSH_HOST_PLATFORM == darwin ]]; then
|
||||
if [[ $BSH_HOST_ARCH == aarch64 ]]; then
|
||||
c_args+=\'-mmacosx-version-min=11.0\',
|
||||
c_link_args+=\'-mmacosx-version-min=11.0\',
|
||||
else
|
||||
c_args+=\'-mmacosx-version-min=10.9\',
|
||||
c_link_args+=\'-mmacosx-version-min=10.9\',
|
||||
fi
|
||||
fi
|
||||
|
||||
meson_configure=meson
|
||||
if [[ $BSH_DEBUG_RELEASE == release ]]; then
|
||||
meson_configure+=$'\t'-Dbuildtype=debugoptimized
|
||||
fi
|
||||
meson_configure+=$'\t'-Db_strip=false
|
||||
meson_configure+=$'\t'-Db_pie=false
|
||||
if [[ $BSH_HOST_PLATFORM-$BSH_HOST_LIBC != windows-msvc ]]; then
|
||||
meson_configure+=$'\t'-Dc_args=[\'-ffunction-sections\',\'-fdata-sections\']
|
||||
meson_configure+=$'\t'-Dcpp_args=[\'-ffunction-sections\',\'-fdata-sections\']
|
||||
if [[ $BSH_HOST_PLATFORM == darwin ]]; then
|
||||
meson_configure+=$'\t'-Dc_link_args=[\'-Wl,-dead_strip\']
|
||||
meson_configure+=$'\t'-Dcpp_link_args=[\'-Wl,-dead_strip\']
|
||||
else
|
||||
meson_configure+=$'\t'-Dc_link_args=[\'-Wl,--gc-sections\']
|
||||
meson_configure+=$'\t'-Dcpp_link_args=[\'-Wl,--gc-sections\']
|
||||
fi
|
||||
fi
|
||||
meson_configure+=$'\t'-Dworkaround_gcc_no_pie=true
|
||||
meson_configure+=$'\t'-Db_staticpic=false
|
||||
meson_configure+=$'\t'-Dinstall_check=true
|
||||
meson_configure+=$'\t'-Dmod_id=$MOD_ID
|
||||
@ -166,9 +174,23 @@ fi
|
||||
if [[ $BSH_STATIC_DYNAMIC == static ]]; then
|
||||
meson_configure+=$'\t'-Dstatic=prebuilt
|
||||
if [[ $BSH_HOST_PLATFORM == windows ]]; then
|
||||
meson_configure+=$'\t'-Db_vscrt=static_from_buildtype
|
||||
if [[ $BSH_HOST_LIBC == msvc ]]; then
|
||||
meson_configure+=$'\t'-Db_vscrt=static_from_buildtype
|
||||
else
|
||||
c_link_args+=\'-static\',
|
||||
c_link_args+=\'-static-libgcc\',
|
||||
c_link_args+=\'-static-libstdc++\',
|
||||
fi
|
||||
elif [[ $BSH_HOST_PLATFORM == linux ]]; then
|
||||
c_link_args+=\'-static-libgcc\',
|
||||
c_link_args+=\'-static-libstdc++\',
|
||||
fi
|
||||
fi
|
||||
if [[ $BSH_HOST_PLATFORM == linux ]] && [[ $BSH_HOST_ARCH != aarch64 ]]; then
|
||||
# certain file managers can't run PIEs https://bugzilla.gnome.org/show_bug.cgi?id=737849
|
||||
meson_configure+=$'\t'-Db_pie=false
|
||||
c_link_args+=\'-no-pie\',
|
||||
fi
|
||||
stable_or_beta=no
|
||||
if [[ $RELEASE_TYPE == beta ]]; then
|
||||
meson_configure+=$'\t'-Dbeta=true
|
||||
@ -274,6 +296,10 @@ ANDROID_INI
|
||||
meson_configure+=$'\t'--cross-file=.github/android-ghactions.ini
|
||||
meson_configure+=$'\t'-Dhttp=false
|
||||
fi
|
||||
meson_configure+=$'\t'-Dc_args=[$c_args]
|
||||
meson_configure+=$'\t'-Dcpp_args=[$c_args]
|
||||
meson_configure+=$'\t'-Dc_link_args=[$c_link_args]
|
||||
meson_configure+=$'\t'-Dcpp_link_args=[$c_link_args]
|
||||
$meson_configure build
|
||||
cd build
|
||||
if [[ $BSH_BUILD_PLATFORM == windows ]]; then
|
||||
|
29
meson.build
29
meson.build
@ -208,9 +208,6 @@ else
|
||||
'-DUNICODE',
|
||||
'-D_UNICODE',
|
||||
]
|
||||
if is_static and host_platform != 'android'
|
||||
project_link_args += [ '-static', '-static-libgcc', '-static-libstdc++' ]
|
||||
endif
|
||||
endif
|
||||
if not is_debug
|
||||
args_ccomp += [
|
||||
@ -220,30 +217,14 @@ else
|
||||
'-fomit-frame-pointer',
|
||||
]
|
||||
endif
|
||||
if host_platform == 'darwin'
|
||||
if host_arch == 'aarch64'
|
||||
macosx_version_min = [ '-mmacosx-version-min=11.0' ]
|
||||
else
|
||||
macosx_version_min = [ '-mmacosx-version-min=10.9' ]
|
||||
endif
|
||||
args_ccomp += macosx_version_min
|
||||
project_link_args += macosx_version_min
|
||||
endif
|
||||
if host_platform == 'android'
|
||||
if not is_64bit
|
||||
args_ccomp += [ '-U_FILE_OFFSET_BITS' ]
|
||||
endif
|
||||
# android doesn't ship libc++_shared.so, so we might as well link it statically;
|
||||
# the alternative would be to grab libc++_shared.so from the NDK and ship it with
|
||||
# the app alongside libpowder.so, and possibly add it to SDL's list of libraries to load
|
||||
project_link_args += [ '-static-libstdc++' ]
|
||||
else
|
||||
if not get_option('b_pie') and get_option('workaround_gcc_no_pie') # nice one, meson
|
||||
if host_arch != 'aarch64' # no position independent executable for aarch64
|
||||
if c_compiler.get_id() in [ 'clang' ]
|
||||
project_link_args += [ '-Wl,-no_pie' ]
|
||||
else
|
||||
project_link_args += [ '-no-pie' ]
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
project_c_args += args_ccomp + [
|
||||
'-Wno-implicit-fallthrough',
|
||||
@ -285,10 +266,6 @@ if host_platform == 'windows'
|
||||
endif
|
||||
endforeach
|
||||
endif
|
||||
elif host_platform == 'linux'
|
||||
if is_static
|
||||
project_link_args += [ '-static-libgcc', '-static-libstdc++' ]
|
||||
endif
|
||||
endif
|
||||
|
||||
if host_platform == 'darwin' and lua_variant == 'luajit' and host_arch != 'aarch64'
|
||||
|
Loading…
Reference in New Issue
Block a user