link linux binary (mostly) statically

This commit is contained in:
Struma 2021-02-21 22:23:31 -05:00 committed by Roza
parent 18a9744bad
commit ad03754378
4 changed files with 18 additions and 6 deletions

View file

@ -256,7 +256,7 @@ $(DOWNLOADS)/freetype/autogen.sh:
# OpenAL
openal: init_dirs libogg $(LIBDIR)/libopenal.a
$(LIBDIR)/libOpenAL32.a: $(DOWNLOADS)/openal/cmakebuild/Makefile
$(LIBDIR)/libopenal.a: $(DOWNLOADS)/openal/cmakebuild/Makefile
cd $(DOWNLOADS)/openal/cmakebuild; \
make -j$(NPROC); make install

View file

@ -1,11 +1,11 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
MKXPZ_PREFIX=$(shell gcc -dumpmachine | sed -r "s/(.+)-.+-.+/\1/")
MKXPZ_PREFIX=$(gcc -dumpmachine | sed -r "s/(.+)-.+-.+/\1/")
export LDFLAGS="-L$DIR/build-${MKXPZ_PREFIX}/lib -L$DIR/build-${MKXPZ_PREFIX}/bin"
MKXPZ_OLD_PC=$(pkg-config --variable pc_path pkg-config)
# Try to load the stuff we built first
export PKG_CONFIG_LIBDIR="$DIR/build-${MKXPZ_PREFIX}/lib/pkgconfig:${MKXPZ_OLD_PC}"
export PKG_CONFIG_LIBDIR="$DIR/build-${MKXPZ_PREFIX}/lib/pkgconfig:$DIR/build-${MKXPZ_PREFIX}/lib64/pkgconfig:${MKXPZ_OLD_PC}"
export PATH="$DIR/build-${MKXPZ_PREFIX}/bin:$PATH"
export LD_LIBRARY_PATH="$DIR/build-${MKXPZ_PREFIX}/lib:${LD_LIBRARY_PATH}"
export MKXPZ_PREFIX="$DIR/build-${MKXPZ_PREFIX}"

View file

@ -116,7 +116,7 @@ if get_option('force32') == true
endif
build_static = false
if get_option('static_executable') == true and host_system == 'windows'
if get_option('static_executable') == true # and host_system == 'windows'
build_static = true
endif

View file

@ -13,7 +13,12 @@ pixman = dependency('pixman-1', static: build_static)
png = dependency('libpng', static: build_static)
jpeg = dependency('libjpeg', static: build_static)
zlib = dependency('zlib', static: build_static)
bz2 = dependency('bzip2', static: build_static)
if host_system == 'windows'
bz2 = dependency('bzip2', static: build_static)
else
bz2 = compilers['cpp'].find_library('bz2')
endif
# If OpenSSL is present, you get HTTPS support
if get_option('enable-https') == true
@ -37,6 +42,11 @@ if host_system == 'windows'
endif
if build_static == true
global_link_args += ['-Wl,-Bstatic', '-lgcc', '-lstdc++', '-lpthread', '-Wl,-Bdynamic']
if host_system == 'windows'
global_link_args += ['-Wl,-Bstatic', '-lgcc', '-lstdc++', '-lpthread', '-Wl,-Bdynamic']
else
global_link_args += ['-static-libgcc', '-static-libstdc++']
endif
global_args += '-DAL_LIBTYPE_STATIC'
endif
@ -77,7 +87,9 @@ if get_option('shared_fluid') == true
fluidsynth = dependency('fluidsynth', static: build_static)
add_project_arguments('-DSHARED_FLUID', language: 'cpp')
global_dependencies += fluidsynth
global_dependencies += compilers['cpp'].find_library('dsound')
if host_system == 'windows'
global_dependencies += compilers['cpp'].find_library('dsound')
endif
endif
if get_option('default_framerate') == true