Skip to content

Commit

Permalink
Statically link all non-system provided libraries on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-carlborg committed Dec 6, 2021
1 parent ee6b012 commit 0679e27
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ join() {

install_prerequisite() {
if [ $system = macos ]; then
brew install ninja pixman findutils
brew install ninja pixman findutils glib
else
apk add --no-cache \
g++ \
Expand Down Expand Up @@ -111,14 +111,30 @@ EOF

build_qemu() {
if [ $system = macos ]; then
declare -a extra_ldflags=(
"-framework" "Foundation"
"-liconv"
"-lpcre"
"-lresolv"
"/usr/local/opt/gettext/lib/libintl.a"
"/usr/local/opt/glib/lib/libgio-2.0.a"
"/usr/local/opt/glib/lib/libglib-2.0.a"
"/usr/local/opt/glib/lib/libgobject-2.0.a"
"/usr/local/opt/pixman/lib/libpixman-1.a"
"/usr/local/opt/zstd/lib/libzstd.a"
)

local build_flags=''
local ldflags="$(join ' ' ${extra_ldflags[@]})"
else
local build_flags='--static'
local ldflags=''
fi

mkdir -p qemu/build
pushd qemu/build > /dev/null

LDFLAGS="$ldflags" \
../configure \
--prefix=/tmp/cross-platform-actions \
--disable-auth-pam \
Expand All @@ -130,25 +146,30 @@ build_qemu() {
--disable-debug-mutex \
--disable-dmg \
--disable-docs \
--disable-gcrypt \
--disable-gnutls \
--disable-gtk \
--disable-guest-agent \
--disable-guest-agent-msi \
--disable-hax \
--disable-kvm \
--disable-libiscsi \
--disable-libssh \
--disable-libusb \
--disable-linux-user \
--disable-nettle \
--disable-parallels \
--disable-qcow1 \
--disable-qed \
--disable-sdl \
--disable-smartcard \
--disable-usb-redir \
--disable-user \
--disable-vdi \
--disable-vnc \
--disable-vvfat \
--disable-xen \
--disable-hax \
--disable-vdi \
--enable-tools \
--disable-lzo \
--enable-lto \
--enable-tools \
--target-list="$(join , "${qemu_platforms[@]/%/-softmmu}")" \
Expand Down

0 comments on commit 0679e27

Please sign in to comment.