Merge pull request #5374 from janisozaur/mingw-arch-develop

ArchLinux-based mingw docker image
This commit is contained in:
Michał Janiszewski 2017-04-16 09:06:20 +02:00 committed by GitHub
commit e9ae5cf356
4 changed files with 29 additions and 144 deletions

View File

@ -156,7 +156,9 @@ ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS CXX_WARN_SUGGEST_FINAL_TYPES -Wsugge
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS CXX_WARN_SUGGEST_FINAL_METHODS -Wsuggest-final-methods) ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS CXX_WARN_SUGGEST_FINAL_METHODS -Wsuggest-final-methods)
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS CXX_WARN_SUGGEST_OVERRIDE -Wsuggest-override) ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS CXX_WARN_SUGGEST_OVERRIDE -Wsuggest-override)
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS CXX_WARN_DUPLICATED_COND -Wduplicated-cond) ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS CXX_WARN_DUPLICATED_COND -Wduplicated-cond)
if (MINGW)
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS CXX_WARN_SUGGEST_OVERRIDE -Wno-error=redundant-decls)
endif ()
# Items below are not supported by ICC # Items below are not supported by ICC
ADD_CHECK_C_COMPILER_FLAG(CMAKE_C_FLAGS C_WARN_REDUNDANT_DECLS -Wredundant-decls) ADD_CHECK_C_COMPILER_FLAG(CMAKE_C_FLAGS C_WARN_REDUNDANT_DECLS -Wredundant-decls)
ADD_CHECK_C_COMPILER_FLAG(CMAKE_C_FLAGS C_WARN_IGNORED_QUALIFIERS -Wignored-qualifiers) ADD_CHECK_C_COMPILER_FLAG(CMAKE_C_FLAGS C_WARN_IGNORED_QUALIFIERS -Wignored-qualifiers)

View File

@ -20,46 +20,6 @@ if [[ ! -d build ]]; then
mkdir -p build mkdir -p build
fi fi
if [[ $TARGET != "ubuntu_i686" && $TARGET != "docker32" && $SYSTEM != "Darwin" ]]; then
sha256sum=c71bb6b488376853252a00f3ed216e09d645f71357ea76b9b55c56e40b4f44ca
libVFile="./libversion"
libdir="./lib"
currentversion=0
needsdownload="true"
if [ -f $libVFile ]; then
while read line; do
currentversion=$line
continue
done < $libVFile
fi
if [ "z$currentversion" == "z$sha256sum" ]; then
needsdownload="false"
fi
if [ ! -d $libdir ]; then
needsdownload="true"
fi
if [[ "$needsdownload" = "true" ]]; then
echo "Found library had sha256sum $currentversion, expected $sha256sum"
echo "New libraries need to be downloaded. Clearing cache and calling ./install.sh"
rm -rf ./lib
if [[ -f $cachedir/orctlibs.zip ]]; then
rm -rf $cachedir/orctlibs.zip
fi
if [[ -d /usr/local/cross-tools/orctlibs ]]; then
sudo rm -rf /usr/local/cross-tools/orctlibs
fi
if [[ -d $cachedir/orctlibs ]]; then
rm -rf $cachedir/orctlibs
fi
scripts/linux/install.sh
fi
# if [[ $TARGET != "linux" && $TARGET != "docker32" && $SYSTEM != "Darwin" ]]; then
fi
pushd build pushd build
echo OPENRCT2_CMAKE_OPTS = $OPENRCT2_CMAKE_OPTS echo OPENRCT2_CMAKE_OPTS = $OPENRCT2_CMAKE_OPTS
if [[ $TARGET == "docker32" ]] if [[ $TARGET == "docker32" ]]
@ -96,7 +56,7 @@ pushd build
chmod a+rwx $(pwd) chmod a+rwx $(pwd)
chmod g+s $(pwd) chmod g+s $(pwd)
# CMAKE and MAKE opts from environment # CMAKE and MAKE opts from environment
docker run -v /usr/local/cross-tools/:/usr/local/cross-tools/ -v $PARENT:$PARENT -w $PARENT/build -i -t openrct2/openrct2:mingw bash -c "cmake ../ $OPENRCT2_CMAKE_OPTS && make $OPENRCT_MAKE_OPTS" docker run -v $PARENT:$PARENT -w $PARENT/build -i -t openrct2/openrct2:mingw-arch bash -c "cmake ../ $OPENRCT2_CMAKE_OPTS && make $OPENRCT_MAKE_OPTS"
else else
echo "Unkown target $TARGET" echo "Unkown target $TARGET"
exit 1 exit 1

View File

@ -50,36 +50,6 @@ function download {
fi fi
} }
function download_sdl {
if [[ ! -f $cachedir/SDL2-devel-${SDL2_PV}-mingw.tar.gz ]]; then
download http://libsdl.org/release/SDL2-devel-${SDL2_PV}-mingw.tar.gz $cachedir/SDL2-devel-${SDL2_PV}-mingw.tar.gz;
fi
if [[ ! -f $cachedir/SDL2_ttf-devel-${SDL2_TTF_PV}-mingw.tar.gz ]]; then
download https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-${SDL2_TTF_PV}-mingw.tar.gz $cachedir/SDL2_ttf-devel-${SDL2_TTF_PV}-mingw.tar.gz;
fi
if [[ ! -d $cachedir/SDL2-${SDL2_PV} ]]; then
pushd $cachedir
tar -xzf SDL2-devel-${SDL2_PV}-mingw.tar.gz
popd
fi
if [[ ! -d $cachedir/SDL2_ttf-${SDL2_TTF_PV} ]]; then
pushd $cachedir
tar -xzf SDL2_ttf-devel-${SDL2_TTF_PV}-mingw.tar.gz
popd
fi
# Apply platform patch
mingw_patch=libsdl2-mingw-2.0.3-fix-platform-detection-for-mingw.patch
if [[ ! -f $cachedir/$mingw_patch ]]; then
download "https://github.com/anyc/anyc-overlay/raw/master/media-libs/libsdl2-mingw/files/$mingw_patch" $cachedir/$mingw_patch;
# XXX not sure how to make this idempotent.
pushd $cachedir/SDL2-${SDL2_PV}/i686-w64-mingw32/include/SDL2/
echo "Applying patch."
patch -p2 < ../../../../$mingw_patch
popd
fi
}
function download_libs { function download_libs {
if [[ ! -f $cachedir/orctlibs.zip ]]; then if [[ ! -f $cachedir/orctlibs.zip ]]; then
download $liburl $cachedir/orctlibs.zip; download $liburl $cachedir/orctlibs.zip;
@ -92,35 +62,6 @@ function download_libs {
fi fi
} }
function install_cross_tools {
if [[ ! -d /usr/local/cross-tools ]]; then
sudo mkdir -p /usr/local/cross-tools
fi
if [[ ! -d /usr/local/cross-tools/i686-w64-mingw32 ]]; then
sudo cp -r $cachedir/SDL2-${SDL2_PV}/i686-w64-mingw32 /usr/local/cross-tools/
sudo cp -r $cachedir/SDL2_ttf-${SDL2_TTF_PV}/i686-w64-mingw32 /usr/local/cross-tools/
fi
if [[ ! -d /usr/local/cross-tools/orctlibs ]]; then
sudo mkdir -p /usr/local/cross-tools/orctlibs
sudo cp -rf $cachedir/orctlibs/glob/* /usr/local/cross-tools/orctlibs/.
fi
}
function install_pkg_config {
if [[ ! -f $cachedir/i686-w64-mingw32-pkg-config ]]; then
# If this fails to work because of newlines, be sure you are running this
# script with Bash, and not sh. We should really move this to a separate
# file.
echo -e "#!/bin/sh\nexport PKG_CONFIG_PATH=/usr/local/cross-tools/i686-w64-mingw32/lib/pkgconfig:/usr/local/cross-tools/orctlibs/lib/pkgconfig\npkg-config \$@" > $cachedir/i686-w64-mingw32-pkg-config;
fi
chmod +x $cachedir/i686-w64-mingw32-pkg-config
sudo cp $cachedir/i686-w64-mingw32-pkg-config /usr/local/bin/
ls -al /usr/local/bin | grep pkg-config
cat /usr/local/bin/i686-w64-mingw32-pkg-config
}
function mac_os_install_mingw_32 { function mac_os_install_mingw_32 {
local mingw_name="mingw-w32-bin_i686-darwin" local mingw_name="mingw-w32-bin_i686-darwin"
local mingw_tar="${mingw_name}_20130531.tar.bz2" local mingw_tar="${mingw_name}_20130531.tar.bz2"
@ -162,47 +103,33 @@ if [[ "$(uname)" == "Darwin" ]]; then
brew install jansson sdl2 sdl2_ttf speex --universal brew install jansson sdl2 sdl2_ttf speex --universal
fi fi
elif [[ $(uname) == "Linux" ]]; then elif [[ $(uname) == "Linux" ]]; then
if [[ -z "$TRAVIS" ]]; then # prevent build.sh from re-doing all the steps again
sudo apt-get install -y binutils-mingw-w64-i686 gcc-mingw-w64-i686 g++-mingw-w64-i686 cmake case "$TARGET" in
if [[ -z "$DISABLE_G2_BUILD" ]]; then "ubuntu_i686")
sudo apt-get install -y wine docker pull openrct2/openrct2:ubuntu_i686
fi ;;
else "ubuntu_amd64")
# prevent build.sh from re-doing all the steps again docker pull openrct2/openrct2:ubuntu_amd64
case "$TARGET" in ;;
"ubuntu_i686") "windows")
docker pull openrct2/openrct2:ubuntu_i686 docker pull openrct2/openrct2:mingw-arch
;; ;;
"ubuntu_amd64") "docker32")
docker pull openrct2/openrct2:ubuntu_amd64 docker pull openrct2/openrct2:32bit-only
;; ;;
"windows") "docker64")
docker pull openrct2/openrct2:mingw docker pull openrct2/openrct2:64bit-only
;; ;;
"docker32") *)
docker pull openrct2/openrct2:32bit-only echo "unkown target $TARGET"
;; exit 1
"docker64") esac
docker pull openrct2/openrct2:64bit-only
;;
*)
echo "unkown target $TARGET"
exit 1
esac
fi
fi fi
if [[ $TARGET == "windows" || $(uname -s) == "Darwin" ]]; then if [[ $(uname -s) == "Darwin" ]]; then
download_libs download_libs
calculate_sha256 "$cachedir/orctlibs.zip" > "$libVFile" calculate_sha256 "$cachedir/orctlibs.zip" > "$libVFile"
echo "Downloaded library with sha256sum: $(cat "$libVFile")" echo "Downloaded library with sha256sum: $(cat "$libVFile")"
# Local libs are required for all targets # Local libs are required for all targets
# $TARGET == "windows" || $(uname -s) == "Darwin" # $(uname -s) == "Darwin"
fi
if [[ $TARGET == "windows" ]]; then
download_sdl
install_cross_tools
install_pkg_config
# $TARGET == "windows"
fi fi

View File

@ -1258,14 +1258,10 @@ bool platform_setup_uri_protocol()
HKEY hMuiCacheKey; HKEY hMuiCacheKey;
if (RegCreateKeyW(hRootKey, MUI_CACHE, &hMuiCacheKey) == ERROR_SUCCESS) { if (RegCreateKeyW(hRootKey, MUI_CACHE, &hMuiCacheKey) == ERROR_SUCCESS) {
swprintf_s(buffer, sizeof(buffer), L"%s.FriendlyAppName", exePath); swprintf_s(buffer, sizeof(buffer), L"%s.FriendlyAppName", exePath);
#ifdef __MINGW32__ // mingw-w64 used to define RegSetKeyValueW's signature incorrectly
// mingw-w64 defines RegSetKeyValueW's signature incorrectly // You need at least mingw-w64 5.0 including this commit:
// A fix has already been submitted upstream, this can be be removed after their next release:
// https://sourceforge.net/p/mingw-w64/mingw-w64/ci/da9341980a4b70be3563ac09b5927539e7da21f7/ // https://sourceforge.net/p/mingw-w64/mingw-w64/ci/da9341980a4b70be3563ac09b5927539e7da21f7/
RegSetKeyValueW(hMuiCacheKey, NULL, (LPCSTR)buffer, REG_SZ, (LPCSTR)L"OpenRCT2", sizeof(L"OpenRCT2") + 1);
#else
RegSetKeyValueW(hMuiCacheKey, NULL, buffer, REG_SZ, L"OpenRCT2", sizeof(L"OpenRCT2") + 1); RegSetKeyValueW(hMuiCacheKey, NULL, buffer, REG_SZ, L"OpenRCT2", sizeof(L"OpenRCT2") + 1);
#endif
} }
log_verbose("URI protocol setup successful"); log_verbose("URI protocol setup successful");