Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRolf Theunissen2018-03-10 19:57:01 +0000
committerAlexander Kurtakov2018-03-23 08:53:50 +0000
commite061a646a35408e4c4cbd20733baa1f7e304be3e (patch)
tree851c1a96843eed70ef6cd914011ea20410052ec8
parent7ff1827cdc8b28d83309c71b9acc5929c7997319 (diff)
downloadeclipse.platform.swt-e061a646a35408e4c4cbd20733baa1f7e304be3e.tar.gz
eclipse.platform.swt-e061a646a35408e4c4cbd20733baa1f7e304be3e.tar.xz
eclipse.platform.swt-e061a646a35408e4c4cbd20733baa1f7e304be3e.zip
Bug 488431 - Provide SWT/GTK3 port on Windows
Make GTK build on win32 again Change-Id: Iea9e8fbd53af430b998597449a1445ffd716c5ef Signed-off-by: Rolf Theunissen <rolf.theunissen@altran.com>
-rwxr-xr-xbundles/org.eclipse.swt.tools/gtk/dynamic_deprecated.py9
-rwxr-xr-xbundles/org.eclipse.swt.tools/gtk/dynamic_gtk2_vs_gtk3.py9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_win32.mak9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h1
5 files changed, 31 insertions, 21 deletions
diff --git a/bundles/org.eclipse.swt.tools/gtk/dynamic_deprecated.py b/bundles/org.eclipse.swt.tools/gtk/dynamic_deprecated.py
index 2870e9b1d1..0bd115bd84 100755
--- a/bundles/org.eclipse.swt.tools/gtk/dynamic_deprecated.py
+++ b/bundles/org.eclipse.swt.tools/gtk/dynamic_deprecated.py
@@ -6,7 +6,7 @@ from urllib.request import urlopen
from html.parser import HTMLParser
API_URL = "https://developer.gnome.org/gtk3/stable/api-index-deprecated.html"
-OS_CUSTOM_FILE = "./../org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h"
+OS_FILE = "./../../org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c"
FUNCTION_LIST = []
DEPRECATED_FUNCTION_LIST = []
DEPRECATED_SYMBOLS = ""
@@ -28,20 +28,19 @@ def download_deprecated_symbols():
def populate_function_list():
# Read os_custom.h from file
- with open(OS_CUSTOM_FILE) as f:
+ with open(OS_FILE) as f:
os_custom = f.read()
return str(os_custom);
def find_deprecated_functions(custom_str, dep_str):
- regex = r"((\w)+(_)+(LIB)(\s)+(LIB_)+)+"
+ regex = r"((GTK|GDK)_LOAD_FUNCTION\(fp, (\w+))+"
matchList = re.findall(regex, custom_str)
# Search through list of regex matches, strip the "_LIB" and populate
# the dynamic function list.
for match in matchList:
- location = match[0].find("_LIB")
- function_name = match[0][:location]
+ function_name = match[2]
FUNCTION_LIST.append(function_name)
# Check each dynamic function and see if it's deprecated: if so, populate
diff --git a/bundles/org.eclipse.swt.tools/gtk/dynamic_gtk2_vs_gtk3.py b/bundles/org.eclipse.swt.tools/gtk/dynamic_gtk2_vs_gtk3.py
index 507bece074..bbb0351195 100755
--- a/bundles/org.eclipse.swt.tools/gtk/dynamic_gtk2_vs_gtk3.py
+++ b/bundles/org.eclipse.swt.tools/gtk/dynamic_gtk2_vs_gtk3.py
@@ -20,7 +20,7 @@ API_GTK3_0_URL = "https://developer.gnome.org/gtk3/3.0/api-index-full.html"
API_GTK3_STABLE_URL = "https://developer.gnome.org/gtk3/stable/api-index-full.html"
API_GTK3_DEPRECATED_URL = "https://developer.gnome.org/gtk3/stable/api-index-deprecated.html"
-OS_CUSTOM_FILE = "./../org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h"
+OS_FILE = "./../../org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c"
FUNCTION_LIST = []
GTK2_FUNCTION_LIST = []
GTK30_FUNCTION_LIST = []
@@ -58,20 +58,19 @@ def download_gtk3_deprecated_symbols():
def populate_function_list():
# Read os_custom.h from file
- with open(OS_CUSTOM_FILE) as f:
+ with open(OS_FILE) as f:
os_custom = f.read()
return str(os_custom);
def find_gtk_version_functions(custom_str, gtk2_str, gtk30_str, gtk3x_str, gtk3x_dpr_str):
- regex = r"((\w)+(_)+(LIB)(\s)+(LIB_)+)+"
+ regex = r"((GTK|GDK)_LOAD_FUNCTION\(fp, (\w+))+"
matchList = re.findall(regex, custom_str)
# Search through list of regex matches, strip the "_LIB" and populate
# the dynamic function list.
for match in matchList:
- location = match[0].find("_LIB")
- function_name = match[0][:location]
+ function_name = match[2]
FUNCTION_LIST.append(function_name)
# Check each dynamic function and see if it's deprecated: if so, populate
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_win32.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_win32.mak
index ae25262d36..ee087017c5 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_win32.mak
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_win32.mak
@@ -11,8 +11,12 @@
# Makefile for creating SWT libraries for Linux GTK
-# Uncomment to debug parts of SWT natives
-# SWT_WEBKIT_DEBUG = -DWEBKIT_DEBUG
+#SWT_LIB_DEBUG=1 # to debug glue code in /bundles/org.eclipse.swt/bin/library. E.g os_custom.c:swt_fixed_forall(..)
+# Can be set via environment like: export SWT_LIB_DEBUG=1
+ifdef SWT_LIB_DEBUG
+SWT_DEBUG = -O0 -g3 -ggdb3
+NO_STRIP=1
+endif
include make_common.mak
@@ -77,6 +81,7 @@ ATK_OBJECTS = swt.o atk.o atk_structs.o atk_custom.o atk_stats.o
CFLAGS = -O -Wall \
-DSWT_VERSION=$(SWT_VERSION) \
$(NATIVE_STATS) \
+ $(SWT_DEBUG) \
-DWIN32 -DGTK \
-I$(JAVA_HOME)/include \
-I$(JAVA_HOME)/include/win32 \
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
index a779a44076..c7e19a99c6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
@@ -70,29 +70,35 @@
#define realpath(N,R) _fullpath((R),(N),_MAX_PATH)
#endif
+
#define OS_LOAD_FUNCTION LOAD_FUNCTION
// Hard-link code generated from GTK.java to LIB_GTK
-#define GTK_LOAD_FUNCTION(var, name) \
+#define GTK_LOAD_FUNCTION(var, name) LOAD_FUNCTION_LIB(var, LIB_GTK, name)
+// Hard-link code generated from GTK.java to LIB_GDK
+#define GDK_LOAD_FUNCTION(var, name) LOAD_FUNCTION_LIB(var, LIB_GDK, name)
+
+#ifdef _WIN32
+#define LOAD_FUNCTION_LIB(var, libname, name) \
static int initialized = 0; \
- static void *var = NULL; \
+ static FARPROC var = NULL; \
if (!initialized) { \
- void* handle = dlopen(LIB_GTK, LOAD_FLAGS); \
- if (handle) var = dlsym(handle, #name); \
+ HMODULE hm = LoadLibrary(libname); \
+ if (hm) var = GetProcAddress(hm, #name); \
initialized = 1; \
- CHECK_DLERROR \
}
-
-// Hard-link code generated from GTK.java to LIB_GTK
-#define GDK_LOAD_FUNCTION(var, name) \
+#else
+#define LOAD_FUNCTION_LIB(var, libname, name) \
static int initialized = 0; \
static void *var = NULL; \
if (!initialized) { \
- void* handle = dlopen(LIB_GDK, LOAD_FLAGS); \
+ void* handle = dlopen(libname, LOAD_FLAGS); \
if (handle) var = dlsym(handle, #name); \
initialized = 1; \
CHECK_DLERROR \
}
+#endif
+
#ifdef GDK_WINDOWING_X11
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
index 675a6751c8..bcce6b32a0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
@@ -45,6 +45,7 @@
#define LIB_GDK "libgdk-win32-2.0-0.dll"
#endif
#define LIB_GTHREAD "libgthread-2.0-0.dll"
+#define LIB_GLIB "libglib-2.0-0.dll"
#define LIB_ATK "libatk-1.0-0.dll"
#define LIB_FONTCONFIG "libfontconfig-1.dll"
#else

Back to the top