Here is the patch also as inlined text:
--- old/common/autoconf/help.m4 2014-11-14 10:32:44.000000000 +0100
+++ new/common/autoconf/help.m4 2014-11-14 10:32:44.000000000 +0100
@@ -75,20 +75,18 @@
HELP_MSG="You might be able to fix this by running
'$PKGHANDLER_COMMAND'."
;;
freetype)
- if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
- HELP_MSG="To install freetype, run:
-wget \"http://gnuwin32.sourceforge.net/downlinks/freetype.php\" -O
/tmp/freetype-setup.exe
-chmod +x /tmp/freetype-setup.exe
-/tmp/freetype-setup.exe
-Follow GUI prompts, and install to default directory \"C:\Program Files
(x86)\GnuWin32\".
-After installation, locate lib/libfreetype.dll.a and make a copy with the name
freetype.dll."
- else
- HELP_MSG="You need to build a 64-bit version of freetype.
-This is not readily available.
-You can find source code and build instructions on
-http://www.freetype.org/
-If you put the resulting build in \"C:\Program Files\GnuWin32\", it will be
found automatically."
- fi
+ HELP_MSG="
+The freetype library can now be build during the configure process.
+Download the freetype sources and unpack them into an arbitrary directory:
+
+wget http://download.savannah.gnu.org/releases/freetype/freetype-2.5.3.tar.gz
+tar -xzf freetype-2.5.3.tar.gz
+
+Then run configure with '--with-freetype-src=<freetype_src>'. This will
+automatically build the freetype library into '<freetype_src>/lib64' for 64-bit
+builds or into '<freetype_src>/lib32' for 32-bit builds.
+Afterwards you can always use '--with-freetype-include=<freetype_src>/include'
+and '--with-freetype-lib=<freetype_src>/lib[32|64]' for other builds."
;;
esac
}
--- old/common/autoconf/libraries.m4 2014-11-14 10:32:44.000000000 +0100
+++ new/common/autoconf/libraries.m4 2014-11-14 10:32:44.000000000 +0100
@@ -258,12 +258,95 @@
])
+AC_DEFUN([LIB_BUILD_FREETYPE],
+[
+ FREETYPE_SRC_PATH="$1"
+ BUILD_FREETYPE=yes
+
+ # Check if the freetype sources are acessible..
+ if ! test -d $FREETYPE_SRC_PATH; then
+ AC_MSG_WARN([--with-freetype-src specified, but can't find path
"$FREETYPE_SRC_PATH" - ignoring --with-freetype-src])
+ BUILD_FREETYPE=no
+ fi
+ # ..and contain a vc2010 project file
+ vcxproj_path="$FREETYPE_SRC_PATH/builds/windows/vc2010/freetype.vcxproj"
+ if test "x$BUILD_FREETYPE" = xyes && ! test -s $vcxproj_path; then
+ AC_MSG_WARN([Can't find project file $vcxproj_path (you may try a newer
freetype version) - ignoring --with-freetype-src])
+ BUILD_FREETYPE=no
+ fi
+ # Now check if configure found a version of 'msbuild.exe'
+ if test "x$BUILD_FREETYPE" = xyes && test "x$MSBUILD" == x ; then
+ AC_MSG_WARN([Can't find an msbuild.exe executable (you may try to install
.NET 4.0) - ignoring --with-freetype-src])
+ BUILD_FREETYPE=no
+ fi
+
+ # Ready to go..
+ if test "x$BUILD_FREETYPE" = xyes; then
+
+ # msbuild requires trailing slashes for output directories
+ freetype_lib_path="$FREETYPE_SRC_PATH/lib$OPENJDK_TARGET_CPU_BITS/"
+ freetype_lib_path_unix="$freetype_lib_path"
+ freetype_obj_path="$FREETYPE_SRC_PATH/obj$OPENJDK_TARGET_CPU_BITS/"
+ BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(vcxproj_path)
+ BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(freetype_lib_path)
+ BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH(freetype_obj_path)
+ if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+ freetype_platform=x64
+ else
+ freetype_platform=win32
+ fi
+
+ # The original freetype project file is for VS 2010 (i.e. 'v100'),
+ # so we have to adapt the toolset if building with any other toolsed (i.e.
SDK).
+ # Currently 'PLATFORM_TOOLSET' is set in
'TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT'/
+ # 'TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT' in toolchain_windows.m4
+ AC_MSG_NOTICE([Trying to compile freetype sources with
PlatformToolset=$PLATFORM_TOOLSET to $freetype_lib_path_unix ...])
+
+ # First we try to build the freetype.dll
+ $ECHO -e "@echo off\n"\
+ "$MSBUILD $vcxproj_path "\
+ "/p:PlatformToolset=$PLATFORM_TOOLSET "\
+ "/p:Configuration=\"Release Multithreaded\" "\
+ "/p:Platform=$freetype_platform "\
+ "/p:ConfigurationType=DynamicLibrary "\
+ "/p:TargetName=freetype "\
+ "/p:OutDir=\"$freetype_lib_path\" "\
+ "/p:IntDir=\"$freetype_obj_path\" > freetype.log" >
freetype.bat
+ cmd /c freetype.bat
+
+ if test -s "$freetype_lib_path_unix/freetype.dll"; then
+ # If that succeeds we also build freetype.lib
+ $ECHO -e "@echo off\n"\
+ "$MSBUILD $vcxproj_path "\
+ "/p:PlatformToolset=$PLATFORM_TOOLSET "\
+ "/p:Configuration=\"Release Multithreaded\" "\
+ "/p:Platform=$freetype_platform "\
+ "/p:ConfigurationType=StaticLibrary "\
+ "/p:TargetName=freetype "\
+ "/p:OutDir=\"$freetype_lib_path\" "\
+ "/p:IntDir=\"$freetype_obj_path\" >> freetype.log" >
freetype.bat
+ cmd /c freetype.bat
+
+ if test -s "$freetype_lib_path_unix/freetype.lib"; then
+ # Once we build both, lib and dll, set freetype lib and include path
appropriately
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_SRC_PATH/include"
+ POTENTIAL_FREETYPE_LIB_PATH="$freetype_lib_path_unix"
+ AC_MSG_NOTICE([Compiling freetype sources succeeded! (see freetype.log
for build results)])
+ else
+ BUILD_FREETYPE=no
+ fi
+ else
+ BUILD_FREETYPE=no
+ fi
+ fi
+])
+
AC_DEFUN([LIB_CHECK_POTENTIAL_FREETYPE],
[
POTENTIAL_FREETYPE_INCLUDE_PATH="$1"
POTENTIAL_FREETYPE_LIB_PATH="$2"
METHOD="$3"
-
+
# First check if the files exists.
if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
# We found an arbitrary include file. That's a good sign.
@@ -315,6 +398,8 @@
[specify directory for the freetype include files])])
AC_ARG_WITH(freetype-lib, [AS_HELP_STRING([--with-freetype-lib],
[specify directory for the freetype library])])
+ AC_ARG_WITH(freetype-src, [AS_HELP_STRING([--with-freetype-src],
+ [specify directory with freetype sources to automatically build the
library (experimental, Windows-only)])])
AC_ARG_ENABLE(freetype-bundling,
[AS_HELP_STRING([--disable-freetype-bundling],
[disable bundling of the freetype library with the build result
@<:@enabled on Windows or when using --with-freetype, disabled otherwise@:>@])])
@@ -323,7 +408,7 @@
FREETYPE_BUNDLE_LIB_PATH=
if test "x$FREETYPE_NOT_NEEDED" = xyes; then
- if test "x$with_freetype" != x || test "x$with_freetype_include" != x ||
test "x$with_freetype_lib" != x; then
+ if test "x$with_freetype" != x || test "x$with_freetype_include" != x ||
test "x$with_freetype_lib" != x || test "x$with_freetype_src" != x; then
AC_MSG_WARN([freetype not used, so --with-freetype is ignored])
fi
if test "x$enable_freetype_bundling" != x; then
@@ -334,6 +419,25 @@
BUNDLE_FREETYPE="$enable_freetype_bundling"
+ if test "x$with_freetype_src" != x; then
+ if test "x$OPENJDK_TARGET_OS" = xwindows; then
+ # Try to build freetype if --with-freetype-src was given on Windows
+ LIB_BUILD_FREETYPE([$with_freetype_src])
+ if test "x$BUILD_FREETYPE" = xyes; then
+ # Okay, we built it. Check that it works.
+ LIB_CHECK_POTENTIAL_FREETYPE($POTENTIAL_FREETYPE_INCLUDE_PATH,
$POTENTIAL_FREETYPE_LIB_PATH, [--with-freetype-src])
+ if test "x$FOUND_FREETYPE" != xyes; then
+ AC_MSG_ERROR([Can not use the built freetype at location given by
--with-freetype-src])
+ fi
+ else
+ AC_MSG_NOTICE([User specified --with-freetype-src but building
freetype failed. (see freetype.log for build results)])
+ AC_MSG_ERROR([Consider building freetype manually and using
--with-freetype instead.])
+ fi
+ else
+ AC_MSG_WARN([--with-freetype-src is currently only supported on
Windows - ignoring])
+ fi
+ fi
+
if test "x$with_freetype" != x || test "x$with_freetype_include" != x ||
test "x$with_freetype_lib" != x; then
# User has specified settings
@@ -341,12 +445,12 @@
# If not specified, default is to bundle freetype
BUNDLE_FREETYPE=yes
fi
-
+
if test "x$with_freetype" != x; then
POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype/include"
POTENTIAL_FREETYPE_LIB_PATH="$with_freetype/lib"
fi
-
+
# Allow --with-freetype-lib and --with-freetype-include to override
if test "x$with_freetype_include" != x; then
POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype_include"
@@ -475,7 +579,7 @@
FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH"
fi
fi
-
+
if test "x$FREETYPE_LIBS" = x; then
BASIC_FIXUP_PATH(FREETYPE_LIB_PATH)
if test "x$OPENJDK_TARGET_OS" = xwindows; then
@@ -491,7 +595,7 @@
PREV_CXXCFLAGS="$CXXFLAGS"
PREV_LIBS="$LIBS"
PREV_CXX="$CXX"
- CXXFLAGS="$CXXFLAGS $FREETYPE_CFLAGS"
+ CXXFLAGS="$CXXFLAGS $FREETYPE_CFLAGS"
LIBS="$LIBS $FREETYPE_LIBS"
CXX="$FIXPATH $CXX"
AC_LINK_IFELSE([AC_LANG_SOURCE([[
@@ -509,9 +613,9 @@
AC_MSG_RESULT([no])
AC_MSG_NOTICE([Could not compile and link with freetype. This might
be a 32/64-bit mismatch.])
AC_MSG_NOTICE([Using FREETYPE_CFLAGS=$FREETYPE_CFLAGS and
FREETYPE_LIBS=$FREETYPE_LIBS])
-
+
HELP_MSG_MISSING_DEPENDENCY([freetype])
-
+
AC_MSG_ERROR([Can not continue without freetype. $HELP_MSG])
]
)
--- old/common/autoconf/toolchain.m4 2014-11-14 10:32:45.000000000 +0100
+++ new/common/autoconf/toolchain.m4 2014-11-14 10:32:45.000000000 +0100
@@ -385,6 +385,15 @@
AC_CHECK_PROG([RC], [rc], [rc],,, [/usr/bin/rc])
BASIC_FIXUP_EXECUTABLE(RC)
+ # We need to check for 'msbuild.exe' because at the place where we expect
to
+ # find 'msbuild.exe' there's also a directory called 'msbuild' and
configure
+ # won't find the 'msbuild.exe' executable in that case (and the
+ # 'ac_executable_extensions' is unusable due to performance reasons).
+ # Notice that we intentionally don't fix up the path to MSBUILD because we
+ # will call it in a DOS shell during freetype detection on Windows (see
+ # 'LIB_SETUP_FREETYPE' in "libraries.m4"
+ AC_CHECK_PROG([MSBUILD], [msbuild.exe], [msbuild.exe],,,)
+
# For hotspot, we need these in Windows mixed path,
# so rewrite them all. Need added .exe suffix.
HOTSPOT_CXX="$CXX.exe"
--- old/common/autoconf/toolchain_windows.m4 2014-11-14 10:32:45.000000000
+0100
+++ new/common/autoconf/toolchain_windows.m4 2014-11-14 10:32:45.000000000
+0100
@@ -33,6 +33,10 @@
if test -f "$VS100BASE/$VCVARSFILE"; then
AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using
$METHOD])
VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
+ # PLATFORM_TOOLSET is used during the compilation of the freetype
sources (see
+ # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100',
'v110' or 'v120' for VS 2010, 2012 or VS2013
+ # TODO: improve detection for other versions of VS
+ PLATFORM_TOOLSET="v100"
else
AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using
$METHOD])
AC_MSG_NOTICE([Warning: $VCVARSFILE is missing, this is probably
Visual Studio Express. Ignoring])
@@ -61,6 +65,10 @@
else
VS_ENV_ARGS="/x64"
fi
+ # PLATFORM_TOOLSET is used during the compilation of the freetype
sources (see
+ # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK'
for Windows7.1SDK
+ # TODO: improve detection for other versions of SDK
+ PLATFORM_TOOLSET="Windows7.1SDK"
else
AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using
$METHOD])
AC_MSG_NOTICE([Warning: Installation is broken, SetEnv.Cmd is missing.
Ignoring])