diff --git a/scripts/mingw-x-build-dependencies.sh b/scripts/mingw-x-build-dependencies.sh index cf7f8cf0..95f971d1 100755 --- a/scripts/mingw-x-build-dependencies.sh +++ b/scripts/mingw-x-build-dependencies.sh @@ -58,21 +58,21 @@ fi echo "entering" $MXEDIR cd $MXEDIR -echo 'checkout stable branch' -git checkout stable +echo 'checkout master branch' +git checkout master if [ "`echo $* | grep 64`" ]; then - MXE_TARGETS='x86_64-w64-mingw32' + MXE_TARGETS='x86_64-w64-mingw32.static' if [ "`echo $* | grep download`" ]; then - PACKAGES='download-mpfr download-eigen download-opencsg download-cgal download-qt download-qt5 download-glib download-freetype download-fontconfig download-harfbuzz' + PACKAGES='download-mpfr download-eigen download-opencsg download-cgal download-qtbase download-glib download-freetype download-fontconfig download-harfbuzz' else - PACKAGES='qt qt5 mpfr eigen opencsg cgal glib freetype fontconfig harfbuzz' + PACKAGES='qtbase mpfr eigen opencsg cgal glib freetype fontconfig harfbuzz' fi else - MXE_TARGETS='i686-pc-mingw32' + MXE_TARGETS='i686-w64-mingw32.static' if [ "`echo $* | grep download`" ]; then - PACKAGES='download-mpfr download-eigen download-opencsg download-cgal download-qt download-qt5 download-nsis download-glib download-freetype download-fontconfig download-harfbuzz' + PACKAGES='download-mpfr download-eigen download-opencsg download-cgal download-qtbase download-nsis download-glib download-freetype download-fontconfig download-harfbuzz' else - PACKAGES='qt qt5 mpfr eigen opencsg cgal nsis glib freetype fontconfig harfbuzz' + PACKAGES='qtbase mpfr eigen opencsg cgal nsis glib freetype fontconfig harfbuzz' fi fi echo make $PACKAGES MXE_TARGETS=$MXE_TARGETS -j $NUMCPU JOBS=$NUMJOBS diff --git a/scripts/release-common.sh b/scripts/release-common.sh index 21728398..337dab9b 100755 --- a/scripts/release-common.sh +++ b/scripts/release-common.sh @@ -361,6 +361,9 @@ if [ -n $FONTDIR ]; then MACOSX) cp -a fonts-osx/* $FONTDIR ;; + UNIX_CROSS_WIN) + cp -a "$DEPLOYDIR"/mingw-cross-env/etc/fonts/. "$FONTDIR" + ;; esac fi if [ -n $LIBRARYDIR ]; then diff --git a/scripts/setenv-mingw-xbuild.sh b/scripts/setenv-mingw-xbuild.sh index ea6238bd..2afcafc4 100644 --- a/scripts/setenv-mingw-xbuild.sh +++ b/scripts/setenv-mingw-xbuild.sh @@ -56,9 +56,9 @@ if [ ! -e $DEPLOYDIR ]; then fi if [ "`echo $* | grep 64 `" ]; then - MXETARGETDIR=$MXEDIR/usr/x86_64-w64-mingw32 + MXETARGETDIR=$MXEDIR/usr/x86_64-w64-mingw32.static else - MXETARGETDIR=$MXEDIR/usr/i686-pc-mingw32 + MXETARGETDIR=$MXEDIR/usr/i686-w64-mingw32.static fi if [ ! $MINGWX_SAVED_ORIGINAL_PATH ]; then diff --git a/src/FontCache.cc b/src/FontCache.cc index e801222b..8e1ad9d7 100644 --- a/src/FontCache.cc +++ b/src/FontCache.cc @@ -91,7 +91,7 @@ FontCache::FontCache() // For system installs and dev environments, we leave this alone fs::path fontdir(fs::path(PlatformUtils::resourcesPath()) / "fonts"); if (fs::is_regular_file(fontdir / "fonts.conf")) { - setenv("FONTCONFIG_PATH", boosty::stringy(boosty::absolute(fontdir)).c_str(), 0); + PlatformUtils::setenv("FONTCONFIG_PATH", boosty::stringy(boosty::absolute(fontdir)).c_str(), 0); } // Just load the configs. We'll build the fonts once all configs are loaded diff --git a/src/PlatformUtils.cc b/src/PlatformUtils.cc index 3d2a4d45..eb348c3d 100644 --- a/src/PlatformUtils.cc +++ b/src/PlatformUtils.cc @@ -1,3 +1,5 @@ +#include + #include "PlatformUtils.h" #include "boosty.h" #include @@ -124,3 +126,19 @@ std::string PlatformUtils::resourcesPath() // resourcedir defaults to applicationPath return boosty::stringy(boosty::canonical(resourcedir)); } + +int PlatformUtils::setenv(const char *name, const char *value, int overwrite) +{ +#if defined(WIN32) + const char *ptr = getenv(name); + if ((overwrite == 0) && (ptr != NULL)) { + return 0; + } + + char buf[4096]; + snprintf(buf, sizeof(buf), "%s=%s", name, value); + return _putenv(buf); +#else + return ::setenv(name, value, overwrite); +#endif +} diff --git a/src/PlatformUtils.h b/src/PlatformUtils.h index 0848ee54..ca28134c 100644 --- a/src/PlatformUtils.h +++ b/src/PlatformUtils.h @@ -13,7 +13,17 @@ namespace PlatformUtils { bool createUserLibraryPath(); std::string backupPath(); bool createBackupPath(); - + + /** + * Platform abstraction to set environment variables. Windows/MinGW + * does not support setenv(), but needs _putenv(). + * + * @param name name of the environment variable. + * @param value the value to set for the environment variable. + * @return 0 on success. + */ + int setenv(const char *name, const char *value, int overwrite); + /** * Single character separating path specifications in a list * (e.g. OPENSCADPATH). On Windows that's ';' and on most other