Allow building wxGTK for MSW using MSys2 and configure.

Close https://github.com/wxWidgets/wxWidgets/pull/428
This commit is contained in:
Vadim Zeitlin
2017-05-04 02:51:52 +02:00
7 changed files with 225 additions and 32 deletions

25
configure vendored
View File

@@ -7918,6 +7918,8 @@ fi
eval "$wx_cv_use_iniconf"
fi
enablestring=
defaultval=$wxUSE_ALL_FEATURES
@@ -7947,7 +7949,6 @@ fi
eval "$wx_cv_use_regkey"
fi
if test "$wxUSE_GUI" = "yes"; then
@@ -22111,7 +22112,9 @@ rm -f core conftest.err conftest.$ac_objext \
if test -z "$wx_cv_lib_gtk"; then
wx_cv_lib_gtk=none
else
GTK_LIBS="$GTK_LIBS -lX11"
if test "$USE_WIN32" != 1 ; then
GTK_LIBS="$GTK_LIBS -lX11"
fi
wx_cv_cflags_gtk=$GTK_CFLAGS
wx_cv_libs_gtk=$GTK_LIBS
@@ -28766,7 +28769,7 @@ else
$as_echo "$as_me: WARNING: wxGetDiskSpace() function won't work without statfs()" >&2;}
fi
if test "$wxUSE_SNGLINST_CHECKER" = "yes"; then
if test "$wxUSE_SNGLINST_CHECKER" = "yes" -a "$USE_WIN32" != 1 ; then
for ac_func in fcntl flock
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -31306,7 +31309,7 @@ fi
if test "$wxUSE_FSWATCHER" = "yes"; then
if test "$wxUSE_MSW" != "1"; then
if test "$USE_WIN32" != 1; then
if test "$wxUSE_UNIX" = "yes"; then
for ac_header in sys/inotify.h
do :
@@ -33495,7 +33498,7 @@ done
if test "$wxUSE_SOCKETS" = "yes"; then
if test "$TOOLKIT" != "MSW"; then
if test "$USE_WIN32" != 1 ; then
ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket"
if test "x$ac_cv_func_socket" = xyes; then :
@@ -33558,7 +33561,7 @@ fi
fi
if test "$wxUSE_SOCKETS" = "yes" ; then
if test "$TOOLKIT" != "MSW"; then
if test "$USE_WIN32" != 1 ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking what is the type of the third argument of getsockname" >&5
$as_echo_n "checking what is the type of the third argument of getsockname... " >&6; }
if ${wx_cv_type_getsockname3+:} false; then :
@@ -35371,11 +35374,6 @@ if test "$wxUSE_MSW" = 1 ; then
fi
if test "$wxUSE_DIB" = "yes"; then
$as_echo "#define wxUSE_WXDIB 1" >>confdefs.h
fi
if test "$wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW" = "yes"; then
$as_echo "#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1" >>confdefs.h
@@ -35454,6 +35452,11 @@ $as_echo "$as_me: WARNING: Debug help API and wxStackWalker won't be available"
fi
fi
if test "$wxUSE_DIB" = "yes"; then
$as_echo "#define wxUSE_WXDIB 1" >>confdefs.h
fi
if test "$wxUSE_INICONF" = "yes"; then
$as_echo "#define wxUSE_INICONF 1" >>confdefs.h

View File

@@ -749,9 +749,10 @@ WX_ARG_FEATURE(threads, [ --enable-threads use threads], wxUSE_THREA
if test "$wxUSE_MSW" = 1 ; then
WX_ARG_DISABLE(dbghelp, [ --enable-dbghelp use dbghelp.dll API (Win32 only)], wxUSE_DBGHELP)
WX_ARG_ENABLE(iniconf, [ --enable-iniconf use wxIniConfig (Win32 only)], wxUSE_INICONF)
WX_ARG_FEATURE(regkey, [ --enable-regkey use wxRegKey class (Win32 only)], wxUSE_REGKEY)
fi
WX_ARG_FEATURE(regkey, [ --enable-regkey use wxRegKey class (Win32 only)], wxUSE_REGKEY)
if test "$wxUSE_GUI" = "yes"; then
dnl ---------------------------------------------------------------------------
@@ -2782,8 +2783,10 @@ if test "$wxUSE_GUI" = "yes"; then
dnl looks better in AC_MSG_RESULT
wx_cv_lib_gtk=none
else
dnl we use symbols from X11 directly so we should link with it
GTK_LIBS="$GTK_LIBS -lX11"
if test "$USE_WIN32" != 1 ; then
dnl we use symbols from X11 directly so we should link with it
GTK_LIBS="$GTK_LIBS -lX11"
fi
dnl we need to cache GTK_CFLAGS and GTK_LIBS for the
dnl subsequent runs
@@ -4345,7 +4348,7 @@ fi
dnl check for fcntl() or at least flock() needed by Unix implementation of
dnl wxSingleInstanceChecker
if test "$wxUSE_SNGLINST_CHECKER" = "yes"; then
if test "$wxUSE_SNGLINST_CHECKER" = "yes" -a "$USE_WIN32" != 1 ; then
AC_CHECK_FUNCS(fcntl flock, break)
if test "$ac_cv_func_fcntl" != "yes" -a "$ac_cv_func_flock" != "yes"; then
@@ -5293,10 +5296,10 @@ dnl File system watcher checks
dnl ---------------------------------------------------------------------------
if test "$wxUSE_FSWATCHER" = "yes"; then
dnl wxFileSystemWatcher is always available under MSW but we need either
dnl wxFileSystemWatcher is always available under Windows but we need either
dnl inotify or kqueue support in the system for it under Unix (this
dnl includes OS X which does have kqueue but no other platforms)
if test "$wxUSE_MSW" != "1"; then
if test "$USE_WIN32" != 1; then
if test "$wxUSE_UNIX" = "yes"; then
AC_CHECK_HEADERS(sys/inotify.h,,, [AC_INCLUDES_DEFAULT()])
if test "$ac_cv_header_sys_inotify_h" = "yes"; then
@@ -5962,8 +5965,8 @@ dnl wxSocket
dnl ------------------------------------------------------------------------
if test "$wxUSE_SOCKETS" = "yes"; then
dnl under MSW we always have sockets
if test "$TOOLKIT" != "MSW"; then
dnl under Windows we always have sockets
if test "$USE_WIN32" != 1 ; then
dnl under Solaris and OS/2, socket functions live in -lsocket
AC_CHECK_FUNC(socket,,
[
@@ -5982,10 +5985,8 @@ if test "$wxUSE_SOCKETS" = "yes"; then
fi
if test "$wxUSE_SOCKETS" = "yes" ; then
dnl this test may be appropriate if building under cygwin
dnl right now I'm assuming it also uses the winsock stuff
dnl like mingw does.. -- RL
if test "$TOOLKIT" != "MSW"; then
dnl under Windows we do not use getsockname
if test "$USE_WIN32" != 1 ; then
dnl determine the type of third argument for getsockname
dnl This test needs to be done in C++ mode since gsocket.cpp now
dnl is C++ code and pointer cast that are possible even without
@@ -7264,10 +7265,6 @@ if test "$wxUSE_MSW" = 1 ; then
AC_DEFINE(wxUSE_DC_CACHEING)
fi
if test "$wxUSE_DIB" = "yes"; then
AC_DEFINE(wxUSE_WXDIB)
fi
if test "$wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW" = "yes"; then
AC_DEFINE(wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW)
fi
@@ -7316,6 +7313,10 @@ if test "$USE_WIN32" = 1 ; then
fi
fi
if test "$wxUSE_DIB" = "yes"; then
AC_DEFINE(wxUSE_WXDIB)
fi
if test "$wxUSE_INICONF" = "yes"; then
AC_DEFINE(wxUSE_INICONF)
fi

96
docs/msw/msys2-gtk.txt Normal file
View File

@@ -0,0 +1,96 @@
Building wxGTK port with Win32 MSys2 GDK backend
------------------------------------------------
GTK+ widget toolkit has multiple GDK backends and one of them is Win32.
It is a wrapper around Windows API.
These notes don't consider building wxGTK with X11 backend under Windows.
The MSys2 website is http://www.msys2.org/
These building steps are NOT the normal way to build MSys2 MinGW packages.
But, they are a way the wxWidgets developers can test that wxWidgets
can build the wxGTK/Win32 libraries under MSys2 MinGW.
For the MSys2 way please see https://github.com/Alexpux/MINGW-packages
Building steps:
#Note: The "#" is used in front of a comment to help the people who cut
# and paste these directions.
#Warning: At the time these directions were written the GTK version 3
# was NOT able to create wxGTK/Win32 libraries that were usable.
#1. Install the mingw32 packages needed to build wxGTK/Win32 using the
# configure/make build method.
# From the MSys2 prompt or MSys2 MinGW prompt:
# The 32 bit Mingw packages are prefixed with "mingw-w64-i686-";
# Change the prefix to "mingw-w64-x86_64-" if you wish to do 64 bit.
pacman -S make
pacman -S mingw-w64-i686-cppunit
pacman -S mingw-w64-i686-libjpeg-turbo
pacman -S mingw-w64-i686-libpng
pacman -S mingw-w64-i686-libtiff
pacman -S mingw-w64-i686-gcc
pacman -S mingw-w64-i686-pkg-config
## gtk2 can take a long time to update/find fonts
pacman -S mingw-w64-i686-gtk2
# Packages that are needed but are normally installed already.
pacman -S mingw-w64-i686-gcc-libs
pacman -S mingw-w64-i686-expat
pacman -S mingw-w64-i686-xz
pacman -S mingw-w64-i686-zlib
pacman -S mingw-w64-i686-gdk-pixbuf2
#2. Build the wxGTK/Win32 static library
#2a.Open MSys2 MinGW Prompt
# (These steps were tested on MinGW32; but, should work under MinGW64)
#2b.Use the cd command to change directory to the wxWidgets top folder.
#2c.Create the "build-gtk2-static" folder to build the static libraries
mkdir -p build-gtk2-static
#2d.Configure wxWidgets
# Option "--disable-precomp-headers" is NOT needed.
# I am doing it to check for compile issues;
# And, I think my old 32 bit Windows machine
# works best with it disabled.
cd build-gtk2-static && \
../configure --with-gtk=2 \
--disable-shared \
--disable-precomp-headers \
&& cd ..
#2e.make the wxGTK static libraries
cd build-gtk2-static && make && cd ..
#3 Build and run the minimal static sample
#3a.Build the minimal sample
cd build-gtk2-static/samples/minimal && make && cd ../../..
#3b.Run the minimal sample
./build-gtk2-static/samples/minimal/minimal.exe
#4 Build and run the typetest static sample to verify MIME database works
cd build-gtk2-static/samples/typetest && make && cd ../../..
./build-gtk2-static/samples/typetest/typetest.exe
#5 Build and run the drawing static sample
cd build-gtk2-static/samples/drawing && make && cd ../../..
cd samples/drawing && ../../build-gtk2-static/samples/drawing/drawing.exe && cd ../..
#6 Build and run the splash static sample
cd build-gtk2-static/samples/splash && make && cd ../../..
cd samples/splash && ../../build-gtk2-static/samples/splash/splash.exe && cd ../..
#7 Build and run the widgets static sample
cd build-gtk2-static/samples/widgets && make && cd ../../..
cd samples/widgets && ../../build-gtk2-static/samples/widgets/widgets.exe && cd ../..

84
docs/msw/msys2-msw.txt Normal file
View File

@@ -0,0 +1,84 @@
Building wxMSW port with Win32 MSys2 backend
------------------------------------------------
The MSys2 website is http://www.msys2.org/
These building steps are NOT the normal way to build MSys2 MinGW packages.
But, they are a way the wxWidgets developers can test that wxWidgets
can build the wxMSW libraries under MSys2 MinGW.
For the MSys2 way please see https://github.com/Alexpux/MINGW-packages
Building steps:
#Note: The "#" is used in front of a comment to help the people who cut
# and paste these directions.
#1. Install the mingw32 packages needed to build wxMSW using the
# configure/make build method.
# From the MSys2 prompt or MSys2 MinGW prompt:
# The 32 bit Mingw packages are prefixed with "mingw-w64-i686-";
# Change the prefix to "mingw-w64-x86_64-" if you wish to do 64 bit.
pacman -S make
pacman -S mingw-w64-i686-cppunit
pacman -S mingw-w64-i686-libjpeg-turbo
pacman -S mingw-w64-i686-libpng
pacman -S mingw-w64-i686-libtiff
pacman -S mingw-w64-i686-gcc
# Packages that are needed but are normally installed already.
pacman -S mingw-w64-i686-gcc-libs
pacman -S mingw-w64-i686-expat
pacman -S mingw-w64-i686-xz
pacman -S mingw-w64-i686-zlib
#2. Build the wxMSW static library
#2a.Open MSys2 MinGW Prompt
# (These steps were tested on MinGW32; but, should work under MinGW64)
#2b.Use the cd command to change directory to the wxWidgets top folder.
#2c.Create the "build-msw-static" folder to build the static libraries
mkdir -p build-msw-static
#2d.Configure wxWidgets
# Option "--disable-precomp-headers" is NOT needed.
# I am doing it to check for compile issues;
# And, I think my old 32 bit Windows machine
# works best with it disabled.
cd build-msw-static && \
../configure --with-msw \
--disable-shared \
--disable-precomp-headers \
&& cd ..
#2e.make the wxMSW static libraries
cd build-msw-static && make && cd ..
#3 Build and run the minimal static sample
#3a.Build the minimal sample
cd build-msw-static/samples/minimal && make && cd ../../..
#3b.Run the minimal sample
./build-msw-static/samples/minimal/minimal.exe
#4 Build and run the typetest static sample to verify MIME database works
cd build-msw-static/samples/typetest && make && cd ../../..
./build-msw-static/samples/typetest/typetest.exe
#5 Build and run the drawing static sample
cd build-msw-static/samples/drawing && make && cd ../../..
cd samples/drawing && ../../build-msw-static/samples/drawing/drawing.exe && cd ../..
#6 Build and run the splash static sample
cd build-msw-static/samples/splash && make && cd ../../..
cd samples/splash && ../../build-msw-static/samples/splash/splash.exe && cd ../..
#7 Build and run the widgets static sample
cd build-msw-static/samples/widgets && make && cd ../../..
cd samples/widgets && ../../build-msw-static/samples/widgets/widgets.exe && cd ../..

View File

@@ -23,7 +23,9 @@
class WXDLLIMPEXP_CORE wxGTKMimeTypesManagerImpl : public wxMimeTypesManagerImpl
{
protected:
#if defined(__UNIX__)
wxString GetIconFromMimeType(const wxString& mime) wxOVERRIDE;
#endif
};

View File

@@ -183,11 +183,6 @@
#define wxUSE_SECRETSTORE 0
#endif
#if !wxUSE_OWNER_DRAWN && !defined(__WXUNIVERSAL__)
# undef wxUSE_CHECKLISTBOX
# define wxUSE_CHECKLISTBOX 0
#endif
#if wxUSE_SPINCTRL
# if !wxUSE_SPINBTN
# ifdef wxABORT_ON_CONFIG_ERROR
@@ -199,6 +194,16 @@
# endif
#endif
/* wxMSW-specific checks: notice that this file is also used with wxUniv
and can even be used with wxGTK, when building it under Windows.
*/
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
# if !wxUSE_OWNER_DRAWN
# undef wxUSE_CHECKLISTBOX
# define wxUSE_CHECKLISTBOX 0
# endif
#endif
/*
Compiler-specific checks.
*/

View File

@@ -19,6 +19,7 @@
#include "wx/gtk/private/string.h"
#include "wx/gtk/private/object.h"
#if defined(__UNIX__)
wxString wxGTKMimeTypesManagerImpl::GetIconFromMimeType(const wxString& mime)
{
wxString icon;
@@ -58,6 +59,7 @@ wxString wxGTKMimeTypesManagerImpl::GetIconFromMimeType(const wxString& mime)
#endif // GTK_CHECK_VERSION(2,14,0)
return icon;
}
#endif // defined(__UNIX__)
wxMimeTypesManagerImpl *wxGTKMimeTypesManagerFactory::CreateMimeTypesManagerImpl()
{