summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/abi-suppr.txt9
-rwxr-xr-xscripts/bundle-mac-os.sh20
-rw-r--r--scripts/mingw-meson.conf15
-rwxr-xr-xscripts/mingw.sh185
-rw-r--r--scripts/mingw64.cmake35
5 files changed, 263 insertions, 1 deletions
diff --git a/scripts/abi-suppr.txt b/scripts/abi-suppr.txt
new file mode 100644
index 0000000..98780dd
--- /dev/null
+++ b/scripts/abi-suppr.txt
@@ -0,0 +1,9 @@
+# settings are opaque, ignore all changes
+[suppress_type]
+type_kind = struct
+name = rdp_settings
+
+# allow insertions at end of structs
+[suppress_type]
+type_kind = struct
+has_data_members_inserted_at = end
diff --git a/scripts/bundle-mac-os.sh b/scripts/bundle-mac-os.sh
index 8bb1986..8bd387d 100755
--- a/scripts/bundle-mac-os.sh
+++ b/scripts/bundle-mac-os.sh
@@ -22,6 +22,22 @@ usage () {
echo "target [$DEPLOYMENT_TARGET]"
}
+check_tools() {
+ for TOOL in mkdir rm mv git dirname pwd find cut basename grep xargs cmake ninja autoconf automake aclocal autoheader glibtoolize lipo otool install_name_tool;
+ do
+ set +e
+ TOOL_PATH=$(which "$TOOL")
+ set -e
+ echo "$TOOL: $TOOL_PATH"
+
+ if [ ! -f "$TOOL_PATH" ];
+ then
+ echo "Missing $TOOL! please install and add to PATH."
+ exit 1
+ fi
+ done
+}
+
while [[ $# -gt 0 ]]; do
case $1 in
-a|--arch)
@@ -49,6 +65,8 @@ while [[ $# -gt 0 ]]; do
esac
done
+check_tools
+
fix_rpath() {
SEARCH_PATH=$1
FIX_PATH=$1
@@ -94,7 +112,7 @@ replace_rpath() {
}
CMAKE_ARCHS=
-OSSL_FLAGS="-mmacosx-version-min=$DEPLOYMENT_TARGET"
+OSSL_FLAGS="-mmacosx-version-min=$DEPLOYMENT_TARGET -I$INSTALL/include -L$INSTALL/lib"
for ARCH in $DEPLOYMENT_ARCH;
do
OSSL_FLAGS="$OSSL_FLAGS -arch $ARCH"
diff --git a/scripts/mingw-meson.conf b/scripts/mingw-meson.conf
new file mode 100644
index 0000000..d91c184
--- /dev/null
+++ b/scripts/mingw-meson.conf
@@ -0,0 +1,15 @@
+[binaries]
+c = 'x86_64-w64-mingw32-gcc'
+cpp = 'x86_64-w64-mingw32-g++'
+ar = 'x86_64-w64-mingw32-ar'
+strip = 'x86_64-w64-mingw32-strip'
+exe_wrapper = 'wine64'
+
+[host_machine]
+system = 'windows'
+cpu_family = 'x86_64'
+cpu = 'x86_64'
+endian = 'little'
+
+[properties]
+sysroot = '/usr/x86_64-w64-mingw32'
diff --git a/scripts/mingw.sh b/scripts/mingw.sh
new file mode 100755
index 0000000..420dd47
--- /dev/null
+++ b/scripts/mingw.sh
@@ -0,0 +1,185 @@
+#!/bin/bash -xe
+
+SCRIPT_PATH=$(dirname "${BASH_SOURCE[0]}")
+SCRIPT_PATH=$(realpath "$SCRIPT_PATH")
+
+SRC_BASE="$SCRIPT_PATH/../build-mingw/src"
+BUILD_BASE="$SCRIPT_PATH/../build-mingw/build"
+INSTALL_BASE="$SCRIPT_PATH/../build-mingw/install"
+
+mkdir -p "$SRC_BASE"
+mkdir -p "$BUILD_BASE"
+
+cd "$SRC_BASE"
+git clone -b v3.8.2 https://github.com/libressl/portable.git libressl
+(
+ cd libressl
+ ./update.sh
+)
+cmake \
+ -GNinja \
+ -DCMAKE_TOOLCHAIN_FILE="$SCRIPT_PATH/mingw64.cmake" \
+ -DCMAKE_PREFIX_PATH="$INSTALL_BASE/lib/cmake;$INSTALL_BASE/lib;$INSTALL_BASE" \
+ -DCMAKE_MODULE_PATH="$INSTALL_BASE/lib/cmake;$INSTALL_BASE/lib;$INSTALL_BASE" \
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_BASE" \
+ -S libressl \
+ -B "$BUILD_BASE/libressl" \
+ -DLIBRESSL_APPS=OFF \
+ -DLIBRESSL_TESTS=OFF
+cmake --build "$BUILD_BASE/libressl"
+cmake --install "$BUILD_BASE/libressl"
+
+git clone --depth 1 -b v1.3.1 https://github.com/madler/zlib.git
+cmake \
+ -GNinja \
+ -DCMAKE_TOOLCHAIN_FILE="$SCRIPT_PATH/mingw64.cmake" \
+ -DCMAKE_PREFIX_PATH="$INSTALL_BASE/lib/cmake;$INSTALL_BASE/lib;$INSTALL_BASE" \
+ -DCMAKE_MODULE_PATH="$INSTALL_BASE/lib/cmake;$INSTALL_BASE/lib;$INSTALL_BASE" \
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_BASE" \
+ -S zlib \
+ -B "$BUILD_BASE/zlib"
+cmake --build "$BUILD_BASE/zlib"
+cmake --install "$BUILD_BASE/zlib"
+
+git clone --depth 1 -b uriparser-0.9.7 https://github.com/uriparser/uriparser.git
+cmake \
+ -GNinja \
+ -DCMAKE_TOOLCHAIN_FILE="$SCRIPT_PATH/mingw64.cmake" \
+ -DCMAKE_PREFIX_PATH="$INSTALL_BASE/lib/cmake;$INSTALL_BASE/lib;$INSTALL_BASE" \
+ -DCMAKE_MODULE_PATH="$INSTALL_BASE/lib/cmake;$INSTALL_BASE/lib;$INSTALL_BASE" \
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_BASE" \
+ -S uriparser \
+ -B "$BUILD_BASE/uriparser" \
+ -DURIPARSER_BUILD_DOCS=OFF \
+ -DURIPARSER_BUILD_TESTS=OFF
+cmake --build "$BUILD_BASE/uriparser"
+cmake --install "$BUILD_BASE/uriparser"
+
+git clone --depth 1 -b v1.7.17 https://github.com/DaveGamble/cJSON.git
+cmake \
+ -GNinja \
+ -DCMAKE_TOOLCHAIN_FILE="$SCRIPT_PATH/mingw64.cmake" \
+ -DCMAKE_PREFIX_PATH="$INSTALL_BASE/lib/cmake;$INSTALL_BASE/lib;$INSTALL_BASE" \
+ -DCMAKE_MODULE_PATH="$INSTALL_BASE/lib/cmake;$INSTALL_BASE/lib;$INSTALL_BASE" \
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_BASE" \
+ -S cJSON \
+ -B "$BUILD_BASE/cJSON" \
+ -DENABLE_CJSON_TEST=OFF \
+ -DBUILD_SHARED_AND_STATIC_LIBS=ON
+cmake --build "$BUILD_BASE/cJSON"
+cmake --install "$BUILD_BASE/cJSON"
+
+git clone --depth 1 -b release-2.30.0 https://github.com/libsdl-org/SDL.git
+cmake \
+ -GNinja \
+ -DCMAKE_TOOLCHAIN_FILE="$SCRIPT_PATH/mingw64.cmake" \
+ -DCMAKE_PREFIX_PATH="$INSTALL_BASE/lib/cmake;$INSTALL_BASE/lib;$INSTALL_BASE" \
+ -DCMAKE_MODULE_PATH="$INSTALL_BASE/lib/cmake;$INSTALL_BASE/lib;$INSTALL_BASE" \
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_BASE" \
+ -S SDL \
+ -B "$BUILD_BASE/SDL" \
+ -DSDL_TEST=OFF \
+ -DSDL_TESTS=OFF \
+ -DSDL_STATIC_PIC=ON
+cmake --build "$BUILD_BASE/SDL"
+cmake --install "$BUILD_BASE/SDL"
+
+git clone --depth 1 --shallow-submodules --recurse-submodules -b release-2.22.0 https://github.com/libsdl-org/SDL_ttf.git
+cmake \
+ -GNinja \
+ -DCMAKE_TOOLCHAIN_FILE="$SCRIPT_PATH/mingw64.cmake" \
+ -DCMAKE_PREFIX_PATH="$INSTALL_BASE/lib/cmake;$INSTALL_BASE/lib;$INSTALL_BASE" \
+ -DCMAKE_MODULE_PATH="$INSTALL_BASE/lib/cmake;$INSTALL_BASE/lib;$INSTALL_BASE" \
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_BASE" \
+ -S SDL_ttf \
+ -B "$BUILD_BASE/SDL_ttf" \
+ -DSDL2TTF_HARFBUZZ=ON \
+ -DSDL2TTF_FREETYPE=ON \
+ -DSDL2TTF_VENDORED=ON \
+ -DFT_DISABLE_ZLIB=OFF \
+ -DSDL2TTF_SAMPLES=OFF
+cmake --build "$BUILD_BASE/SDL_ttf"
+cmake --install "$BUILD_BASE/SDL_ttf"
+
+git clone --depth 1 --shallow-submodules --recurse-submodules -b release-2.8.2 https://github.com/libsdl-org/SDL_image.git
+cmake \
+ -GNinja \
+ -DCMAKE_TOOLCHAIN_FILE="$SCRIPT_PATH/mingw64.cmake" \
+ -DCMAKE_PREFIX_PATH="$INSTALL_BASE/lib/cmake;$INSTALL_BASE/lib;$INSTALL_BASE" \
+ -DCMAKE_MODULE_PATH="$INSTALL_BASE/lib/cmake;$INSTALL_BASE/lib;$INSTALL_BASE" \
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_BASE" \
+ -S SDL_image \
+ -B "$BUILD_BASE/SDL_image" \
+ -DSDL2IMAGE_SAMPLES=OFF \
+ -DSDL2IMAGE_DEPS_SHARED=OFF
+cmake --build "$BUILD_BASE/SDL_image"
+cmake --install "$BUILD_BASE/SDL_image"
+
+git clone --depth 1 --shallow-submodules --recurse-submodules -b v1.0.27 https://github.com/libusb/libusb-cmake.git
+cmake \
+ -GNinja \
+ -DCMAKE_TOOLCHAIN_FILE="$SCRIPT_PATH/mingw64.cmake" \
+ -DCMAKE_PREFIX_PATH="$INSTALL_BASE/lib/cmake;$INSTALL_BASE/lib;$INSTALL_BASE" \
+ -DCMAKE_MODULE_PATH="$INSTALL_BASE/lib/cmake;$INSTALL_BASE/lib;$INSTALL_BASE" \
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_BASE" \
+ -S libusb-cmake \
+ -B "$BUILD_BASE/libusb-cmake" \
+ -DLIBUSB_BUILD_EXAMPLES=OFF \
+ -DLIBUSB_BUILD_TESTING=OFF \
+ -DLIBUSB_ENABLE_DEBUG_LOGGING=OFF
+cmake --build "$BUILD_BASE/libusb-cmake"
+cmake --install "$BUILD_BASE/libusb-cmake"
+
+# TODO: This takes ages to compile, disable
+#git clone --depth 1 -b n6.1.1 https://github.com/FFmpeg/FFmpeg.git
+#(
+# cd "$BUILD_BASE"
+# mkdir -p FFmpeg
+# cd FFmpeg
+# "$SRC_BASE/FFmpeg/configure" \
+# --arch=x86_64 \
+# --target-os=mingw64 \
+# --cross-prefix=x86_64-w64-mingw32- \
+# --prefix="$INSTALL_BASE"
+# make -j
+# make -j install
+#)
+
+git clone --depth 1 -b v2.4.1 https://github.com/cisco/openh264.git
+meson setup --cross-file "$SCRIPT_PATH/mingw-meson.conf" \
+ -Dprefix="$INSTALL_BASE" \
+ -Db_pie=true \
+ -Db_lto=true \
+ -Dbuildtype=release \
+ -Dtests=disabled \
+ -Ddefault_library=both \
+ "$BUILD_BASE/openh264" \
+ openh264
+ninja -C "$BUILD_BASE/openh264"
+ninja -C "$BUILD_BASE/openh264" install
+
+cmake \
+ -GNinja \
+ -DCMAKE_TOOLCHAIN_FILE="$SCRIPT_PATH/mingw64.cmake" \
+ -DCMAKE_PREFIX_PATH="$INSTALL_BASE/lib/cmake;$INSTALL_BASE/lib;$INSTALL_BASE" \
+ -DCMAKE_MODULE_PATH="$INSTALL_BASE/lib/cmake;$INSTALL_BASE/lib;$INSTALL_BASE" \
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_BASE" \
+ -S "$SCRIPT_PATH/.." \
+ -B "$BUILD_BASE/freerdp" \
+ -DWITH_SERVER=ON \
+ -DWITH_SHADOW=OFF \
+ -DWITH_PLATFORM_SERVER=OFF \
+ -DWITH_SAMPLE=ON \
+ -DWITH_PLATFORM_SERVER=OFF \
+ -DUSE_UNWIND=OFF \
+ -DSDL_USE_COMPILED_RESOURCES=OFF \
+ -DWITH_SWSCALE=OFF \
+ -DWITH_FFMPEG=OFF \
+ -DWITH_OPENH264=ON \
+ -DWITH_WEBVIEW=OFF \
+ -DWITH_LIBRESSL=ON \
+ -DWITH_MANPAGES=OFF \
+ -DZLIB_INCLUDE_DIR="$INSTALL_BASE/include" \
+ -DZLIB_LIBRARY="$INSTALL_BASE/lib/libzlibstatic.a"
+cmake --build "$BUILD_BASE/freerdp"
+cmake --install "$BUILD_BASE/freerdp"
diff --git a/scripts/mingw64.cmake b/scripts/mingw64.cmake
new file mode 100644
index 0000000..42612dd
--- /dev/null
+++ b/scripts/mingw64.cmake
@@ -0,0 +1,35 @@
+SET(CMAKE_SYSTEM_NAME Windows CACHE STRING "toolchain default")
+
+SET(CMAKE_SYSTEM_PROCESSOR amd64 CACHE STRING "toolchain default")
+
+# https://github.com/meganz/mingw-std-threads
+#
+# we simply compile with the POSIX C++ primitives, but faster is using the wrapper
+SET(CMAKE_C_COMPILER /usr/bin/x86_64-w64-mingw32-gcc-posix CACHE STRING "toolchain default")
+SET(CMAKE_CXX_COMPILER /usr/bin/x86_64-w64-mingw32-g++-posix CACHE STRING "toolchain default")
+SET(CMAKE_RC_COMPILER_INIT /usr/bin/x86_64-w64-mingw32-windres CACHE STRING "toolchain default")
+SET(CMAKE_RC_COMPILER /usr/bin/x86_64-w64-mingw32-windres CACHE STRING "toolchain default")
+SET(CMAKE_AR /usr/bin/x86_64-w64-mingw32-gcc-ar-posix CACHE STRING "toolchain default")
+SET(CMAKE_C_COMPILER_AR /usr/bin/x86_64-w64-mingw32-gcc-ar-posix CACHE STRING "toolchain default")
+SET(CMAKE_CXX_COMPILER_AR /usr/bin/x86_64-w64-mingw32-gcc-ar-posix CACHE STRING "toolchain default")
+SET(CMAKE_RANLIB /usr/bin/x86_64-w64-mingw32-gcc-ranlib-posix CACHE STRING "toolchain default")
+SET(CMAKE_C_COMPILER_RANLIB /usr/bin/x86_64-w64-mingw32-gcc-ranlib-posix CACHE STRING "toolchain default")
+SET(CMAKE_CXX_COMPILER_RANLIB /usr/bin/x86_64-w64-mingw32-gcc-ranlib-posix CACHE STRING "toolchain default")
+SET(CMAKE_LINKER /usr/bin/x86_64-w64-mingw32-ld-posix CACHE STRING "toolchain default")
+SET(CMAKE_NM /usr/bin/x86_64-w64-mingw32-nm-posix CACHE STRING "toolchain default")
+SET(CMAKE_READELF /usr/bin/x86_64-w64-mingw32-readelf CACHE STRING "toolchain default")
+SET(CMAKE_OBJCOPY /usr/bin/x86_64-w64-mingw32-objcopy CACHE STRING "toolchain default")
+SET(CMAKE_OBJDUMP /usr/bin/x86_64-w64-mingw32-objdump CACHE STRING "toolchain default")
+
+SET(CMAKE_SYSROOT /usr/x86_64-w64-mingw32 CACHE STRING "toolchain default")
+
+#set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER CACHE STRING "toolchain default")
+#set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE STRING "toolchain default")
+#set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE STRING "toolchain default")
+#set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY CACHE STRING "toolchain default")
+
+set(CMAKE_WINDOWS_VERSION "WIN10" CACHE STRING "toolchain default")
+set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "toolchain default")
+set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY ON CACHE BOOL "toolchain default")
+set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "toolchain default")
+set(THREADS_PREFER_PTHREAD_FLAG ON CACHE BOOL "toolchain default")