Make flags in mingw-w64 build wrappers configurable
- Add mingw-w64-cmake and mingw-w64-configure - Make default build flags configurable via CUSTOM_MINGW_FLAGS
This commit is contained in:
parent
44458a7402
commit
ac647e596a
|
@ -0,0 +1,32 @@
|
|||
|
||||
pkgname=mingw-w64-cmake
|
||||
pkgver=1
|
||||
pkgrel=13
|
||||
arch=('any')
|
||||
pkgdesc="CMake wrapper for MinGW (mingw-w64)"
|
||||
depends=('cmake' 'mingw-w64-gcc' 'mingw-w64-pkg-config')
|
||||
license=("GPL")
|
||||
url="http://fedoraproject.org/wiki/MinGW"
|
||||
source=("mingw-cmake.sh"
|
||||
"toolchain-mingw.cmake"
|
||||
"mingw-wine.sh")
|
||||
md5sums=('SKIP' 'SKIP' 'SKIP')
|
||||
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
|
||||
|
||||
build() {
|
||||
for _arch in ${_architectures}; do
|
||||
sed "s|@TRIPLE@|${_arch}|g" toolchain-mingw.cmake > toolchain-${_arch}.cmake
|
||||
sed "s|@TRIPLE@|${_arch}|g" mingw-cmake.sh > ${_arch}-cmake
|
||||
sed "s|@TRIPLE@|${_arch}|g" mingw-wine.sh > ${_arch}-wine
|
||||
done
|
||||
}
|
||||
|
||||
package() {
|
||||
install -d "${pkgdir}"/usr/bin
|
||||
install -d "${pkgdir}"/usr/share/mingw
|
||||
for _arch in ${_architectures}; do
|
||||
install -m 644 toolchain-${_arch}.cmake "${pkgdir}"/usr/share/mingw/
|
||||
install -m 755 ${_arch}-cmake "${pkgdir}"/usr/bin/
|
||||
install -m 755 ${_arch}-wine "${pkgdir}"/usr/bin/
|
||||
done
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
mingw_prefix=/usr/@TRIPLE@
|
||||
|
||||
export PKG_CONFIG_LIBDIR="${mingw_prefix}/lib/pkgconfig"
|
||||
|
||||
mingw_flags="${CUSTOM_MINGW_FLAGS:--O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4}"
|
||||
export CFLAGS="$mingw_flags $CFLAGS"
|
||||
export CXXFLAGS="$mingw_flags $CXXFLAGS"
|
||||
|
||||
PATH=${mingw_prefix}/bin:$PATH cmake \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=${mingw_prefix} \
|
||||
-DCMAKE_INSTALL_LIBDIR:PATH=${mingw_prefix}/lib \
|
||||
-DINCLUDE_INSTALL_DIR:PATH=${mingw_prefix}/include \
|
||||
-DLIB_INSTALL_DIR:PATH=${mingw_prefix}/lib \
|
||||
-DSYSCONF_INSTALL_DIR:PATH=${mingw_prefix}/etc \
|
||||
-DSHARE_INSTALL_DIR:PATH=${mingw_prefix}/share \
|
||||
-DBUILD_SHARED_LIBS:BOOL=ON \
|
||||
-DCMAKE_TOOLCHAIN_FILE=/usr/share/mingw/toolchain-@TRIPLE@.cmake \
|
||||
-DCMAKE_CROSSCOMPILING_EMULATOR=/usr/bin/@TRIPLE@-wine \
|
||||
"$@"
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
mingw_prefix=/usr/@TRIPLE@
|
||||
|
||||
# run it in a custom WINEPREFIX to not mess with default ~/.wine
|
||||
# also default prefix might be a 32 bits prefix, which will fail to run x86_64 exes
|
||||
if ! test -d "${WINEPREFIX}"
|
||||
then
|
||||
export WINEPREFIX=~/.wine-@TRIPLE@
|
||||
fi
|
||||
|
||||
# WINEPATH is used to find dlls, otherwise they should lie next to the exe
|
||||
if test -z "${WINEPATH}"
|
||||
then
|
||||
export WINEPATH=${mingw_prefix}/bin
|
||||
fi
|
||||
|
||||
wine "$@"
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
set (CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
# specify the cross compiler
|
||||
set (CMAKE_C_COMPILER @TRIPLE@-gcc)
|
||||
set (CMAKE_CXX_COMPILER @TRIPLE@-g++)
|
||||
|
||||
# where is the target environment
|
||||
set (CMAKE_FIND_ROOT_PATH /usr/@TRIPLE@)
|
||||
|
||||
# search for programs in the build host directories
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
# for libraries and headers in the target directories
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
|
||||
# Make sure Qt can be detected by CMake
|
||||
set (QT_BINARY_DIR /usr/@TRIPLE@/bin /usr/bin)
|
||||
set (QT_INCLUDE_DIRS_NO_SYSTEM ON)
|
||||
|
||||
# set the resource compiler (RHBZ #652435)
|
||||
set (CMAKE_RC_COMPILER @TRIPLE@-windres)
|
||||
set (CMAKE_MC_COMPILER @TRIPLE@-windmc)
|
||||
|
||||
# override boost thread component suffix as mingw-w64-boost is compiled with threadapi=win32
|
||||
set (Boost_THREADAPI win32)
|
||||
|
||||
# These are needed for compiling lapack (RHBZ #753906)
|
||||
set (CMAKE_Fortran_COMPILER @TRIPLE@-gfortran)
|
||||
set (CMAKE_AR:FILEPATH @TRIPLE@-ar)
|
||||
set (CMAKE_RANLIB:FILEPATH @TRIPLE@-ranlib)
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
pkgname=mingw-w64-configure
|
||||
pkgver=0.1
|
||||
pkgrel=2
|
||||
arch=(any)
|
||||
pkgdesc="configure wrapper for MinGW (mingw-w64)"
|
||||
depends=('mingw-w64-gcc' 'mingw-w64-pkg-config')
|
||||
license=("GPL")
|
||||
url="http://fedoraproject.org/wiki/MinGW"
|
||||
source=("mingw-configure.sh")
|
||||
md5sums=('SKIP')
|
||||
|
||||
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
|
||||
|
||||
build() {
|
||||
for _arch in ${_architectures}; do
|
||||
sed "s|@TRIPLE@|${_arch}|g" mingw-configure.sh > ${_arch}-configure
|
||||
done
|
||||
}
|
||||
|
||||
package() {
|
||||
install -d "${pkgdir}"/usr/bin
|
||||
for _arch in ${_architectures}; do
|
||||
install -m 755 ${_arch}-configure "${pkgdir}"/usr/bin/
|
||||
done
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
# check if last arg is a path to configure, else use parent
|
||||
for last; do true; done
|
||||
if test -x "${last}/configure"
|
||||
then
|
||||
config_path="$last"
|
||||
else
|
||||
config_path=".."
|
||||
fi
|
||||
|
||||
mingw_flags="${CUSTOM_MINGW_FLAGS:--O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4}"
|
||||
LDFLAGS=""
|
||||
export CFLAGS="$mingw_flags $CFLAGS"
|
||||
export CXXFLAGS="$mingw_flags $CXXFLAGS"
|
||||
${config_path}/configure --host=@TRIPLE@ --target=@TRIPLE@ --build="$CHOST" \
|
||||
--prefix=/usr/@TRIPLE@ --libdir=/usr/@TRIPLE@/lib --includedir=/usr/@TRIPLE@/include \
|
||||
--enable-shared --enable-static "$@"
|
Loading…
Reference in New Issue