From d9d11bcdc4cff725819f90df6da36592c3f03c1c Mon Sep 17 00:00:00 2001 From: Mayeul Cantan Date: Thu, 28 Jun 2018 21:52:43 +0200 Subject: [PATCH] Merge build scripts together The platform is detected at runtime, and the next steps are adjusted accordingly. --- build.sh | 67 ++++++++++++++++++++++++++++++++++++++++++++++++ build_linux.sh | 31 ---------------------- build_macos.sh | 28 -------------------- build_windows.sh | 37 -------------------------- 4 files changed, 67 insertions(+), 96 deletions(-) create mode 100755 build.sh delete mode 100755 build_linux.sh delete mode 100755 build_macos.sh delete mode 100644 build_windows.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000000..86031fc8fe --- /dev/null +++ b/build.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +set -e # exit if a command fails +set -o pipefail # Will return the exit status of make if it fails + +CFLAGS_COMMON="-O0 -g -DXBOX=1" # Compilation flags for all platforms +POST_BUILD="" + +package_windows() { # Script to prepare the windows exe + mkdir -p dist + cp i386-softmmu/qemu-system-i386.exe dist/xqemu.exe + cp i386-softmmu/qemu-system-i386w.exe dist/xqemuw.exe + python2 ./get_deps.py dist/xqemu.exe dist + strip dist/xqemu.exe + strip dist/xqemuw.exe +} + +case "$(uname -s)" in # adjust compilation option based on platform + Linux) + echo "Compiling for Linux..." + CFLAGS="-march=native -Wno-error=redundant-decls -Wno-error=unused-but-set-variable" + CONFIGURE="--enable-kvm --disable-xen --disable-werror" + ;; + Darwin) + echo "Compiling for MacOS..." + CFLAGS="-march=native" + CONFIGURE="--disable-cocoa" + ;; + CYGWIN*|MINGW*|MSYS*) + echo "Compiling for Windows..." + CFLAGS="-Wno-error" + CONFIGURE="--python=python2 --disable-cocoa --disable-opengl" + POST_BUILD="package_windows" # set the above function to be called after build + ;; + *) + echo "Could not detect OS $(uname -s), aborting." + exit -1 + ;; +esac + +set -x # Print commands from now on + +./configure \ + --enable-debug \ + --extra-cflags="$CFLAGS_COMMON $CFLAGS" \ + $CONFIGURE \ + --target-list=i386-softmmu \ + --enable-sdl \ + --with-sdlabi=2.0 \ + --disable-curl \ + --disable-vnc \ + --disable-docs \ + --disable-tools \ + --disable-guest-agent \ + --disable-tpm \ + --disable-live-block-migration \ + --disable-replication \ + --disable-capstone \ + --disable-fdt \ + --disable-libiscsi \ + --disable-spice \ + --disable-user \ + +time make -j4 2>&1 | tee build.log + +$POST_BUILD # call post build functions + diff --git a/build_linux.sh b/build_linux.sh deleted file mode 100755 index 4caf70dfbf..0000000000 --- a/build_linux.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -set -e # exit if a command fails -set -x # Print commands -set -o pipefail # Will return the exit status of make if it fails - -./configure \ - --enable-debug \ - --extra-cflags="-march=native -g -O0 -Wno-error=redundant-decls -Wno-error=unused-but-set-variable -DXBOX=1" \ - --disable-werror \ - --target-list=i386-softmmu \ - --enable-sdl \ - --enable-kvm \ - --disable-xen \ - --with-sdlabi=2.0 \ - --disable-curl \ - --disable-vnc \ - --disable-docs \ - --disable-tools \ - --disable-guest-agent \ - --disable-tpm \ - --disable-live-block-migration \ - --disable-replication \ - --disable-capstone \ - --disable-fdt \ - --disable-libiscsi \ - --disable-spice \ - --disable-user \ - -time make -j4 2>&1 | tee build.log - diff --git a/build_macos.sh b/build_macos.sh deleted file mode 100755 index e4b5f6d9aa..0000000000 --- a/build_macos.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -set -e # exit if a command fails -set -x # Print commands -set -o pipefail # Will return the exit status of make if it fails - -./configure \ - --enable-debug \ - --extra-cflags="-march=native -g -O0 -DXBOX=1" \ - --target-list=i386-softmmu \ - --enable-sdl \ - --disable-cocoa \ - --with-sdlabi=2.0 \ - --disable-curl \ - --disable-vnc \ - --disable-docs \ - --disable-tools \ - --disable-guest-agent \ - --disable-tpm \ - --disable-live-block-migration \ - --disable-replication \ - --disable-capstone \ - --disable-fdt \ - --disable-libiscsi \ - --disable-spice \ - --disable-user \ - -time make -j4 2>&1 | tee build.log diff --git a/build_windows.sh b/build_windows.sh deleted file mode 100644 index 6dafe119e3..0000000000 --- a/build_windows.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -set -e # exit if a command fails -set -x # Print commands -set -o pipefail # Will return the exit status of make if it fails - -./configure \ - --python=python2 \ - --enable-debug \ - --extra-cflags="-g -O0 -Wno-error -DXBOX=1" \ - --target-list=i386-softmmu \ - --enable-sdl \ - --disable-cocoa \ - --with-sdlabi=2.0 \ - --disable-curl \ - --disable-vnc \ - --disable-docs \ - --disable-tools \ - --disable-guest-agent \ - --disable-tpm \ - --disable-live-block-migration \ - --disable-replication \ - --disable-capstone \ - --disable-fdt \ - --disable-libiscsi \ - --disable-spice \ - --disable-user \ - --disable-opengl \ - -time make -j4 2>&1 | tee build.log - -mkdir -p dist -cp i386-softmmu/qemu-system-i386.exe dist/xqemu.exe -cp i386-softmmu/qemu-system-i386w.exe dist/xqemuw.exe -python2 ./get_deps.py dist/xqemu.exe dist -strip dist/xqemu.exe -strip dist/xqemuw.exe