Skip to content

Commit

Permalink
Add support for a LLVM-based MinGW toolchain
Browse files Browse the repository at this point in the history
Based on https://github.com/mstorsjo/llvm-mingw.

An advantage of a LLVM/Clang/LLD based mingw-w64 toolchain is that it has proper C++ threads which uses the win32 native thread functions directly. This toolchain might also be useful if we need to target Windows on ARM.
  • Loading branch information
kleisauke committed Dec 7, 2019
1 parent 3562504 commit f8c17ee
Show file tree
Hide file tree
Showing 39 changed files with 1,802 additions and 214 deletions.
36 changes: 23 additions & 13 deletions 8.8/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,41 @@ if [ ! "$curr_revision" = "$revision" ]; then
fi

if [ "$initialize" = true ] ; then
# Copy settings
cp -f $work_dir/settings.mk $mxe_dir

# Copy our customized tool
cp -f $work_dir/tools/make-shared-from-static $mxe_dir/tools

# Copy our customized Meson cross file
cp -f $work_dir/mxe-crossfile.meson.in $mxe_dir/plugins/meson-wrapper/conf
fi

# Prepare MinGW directories
mkdir -p $mxe_prefix/$target.$deps/mingw/{bin,include,lib}
# The 'plugins' variable controls which plugins are in use.
if [ "$LLVM" = "true" ]; then
echo "llvm-mingw plugin enabled"
plugins="$work_dir/plugins/llvm-mingw"

# Build pe-util, handy for copying DLL dependencies.
make pe-util MXE_TARGETS=`$mxe_dir/ext/config.guess`
# Copy LLVM settings
cp -f $work_dir/settings/llvm.mk $mxe_dir/settings.mk
cp -f $work_dir/settings/meson-llvm.in $mxe_dir/plugins/meson-wrapper/conf/mxe-crossfile.meson.in
else
# Build with GCC 9.2
plugins="plugins/gcc9"

# This variable controls which plugins are in use.
# Build with GCC 9.2 and use the meson-wrapper.
plugins="plugins/gcc9 plugins/meson-wrapper $work_dir"
# Copy GCC settings
cp -f $work_dir/settings/gcc.mk $mxe_dir/settings.mk
cp -f $work_dir/settings/meson-gcc.in $mxe_dir/plugins/meson-wrapper/conf/mxe-crossfile.meson.in
fi

# Use the meson-wrapper and our custom overrides
plugins+=" plugins/meson-wrapper $work_dir"

if [ "$MOZJPEG" = "true" ]; then
echo "MozJPEG plugin enabled"
plugins+=" $work_dir/plugins/mozjpeg"
fi

# Prepare MinGW directories
mkdir -p $mxe_prefix/$target.$deps/mingw/{bin,include,lib}

# Build pe-util, handy for copying DLL dependencies.
make pe-util MXE_TARGETS=`$mxe_dir/ext/config.guess`

# Build MXE's meson-wrapper (needed by pango, GDK-PixBuf, GLib and Orc),
# gendef (a tool for generating def files from DLLs)
# and libvips (+ dependencies).
Expand Down
4 changes: 2 additions & 2 deletions 8.8/libheif.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ $(PKG)_GH_CONF := strukturag/libheif/releases,v
$(PKG)_DEPS := cc libde265 x265

define $(PKG)_BUILD
cd '$(BUILD_DIR)' && $(TARGET)-cmake '$(SOURCE_DIR)' \
-DCMAKE_CXX_FLAGS='-Wno-error=unused-variable'
cd '$(BUILD_DIR)' && $(TARGET)-cmake '$(SOURCE_DIR)'

$(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)'
$(MAKE) -C '$(BUILD_DIR)' -j 1 install
endef
14 changes: 9 additions & 5 deletions 8.8/mingw-std-threads.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ PKG := mingw-std-threads
$(PKG)_WEBSITE := https://github.com/meganz/mingw-std-threads
$(PKG)_DESCR := Standard threads implementation currently still missing on MinGW GCC on Windows
$(PKG)_IGNORE :=
$(PKG)_VERSION := 4e22f33
$(PKG)_CHECKSUM := 92c051b9e5017ecbe85e0004677315f5a2784bca9f61db17655321788fe2594a
# https://github.com/gitapi/repos/meganz/mingw-std-threads/tarball/bee085c0a6cb32c59f0b55c7bba976fe6dcfca7f
$(PKG)_VERSION := bee085c
$(PKG)_CHECKSUM := eaa451e3db0b64b285ae2bc163e30f384ee933bb2765ed428b95686a94814dd7
$(PKG)_GH_CONF := meganz/mingw-std-threads/branches/master
$(PKG)_DEPS := cc
$(PKG)_TYPE := script
$(PKG)_DEPS :=


define $(PKG)_BUILD
$(INSTALL) -d '$(PREFIX)/$(TARGET)/include/$(PKG)'
$(INSTALL) -m644 '$(SOURCE_DIR)/'*.h '$(PREFIX)/$(TARGET)/include/$(PKG)'
$(if $(findstring win32,$(TARGET)),\
$(INSTALL) -d '$(PREFIX)/$(TARGET)/include/$(PKG)'; \
$(INSTALL) -m644 '$(SOURCE_DIR)/'*.h '$(PREFIX)/$(TARGET)/include/$(PKG)')
endef
2 changes: 2 additions & 0 deletions 8.8/orc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ endef

define $(PKG)_BUILD
'$(TARGET)-meson' \
--buildtype=release \
--strip \
--libdir='lib' \
--includedir='include' \
-Dbenchmarks=disabled \
Expand Down
Loading

0 comments on commit f8c17ee

Please sign in to comment.