Skip to main content
diff options
authorLeo Ufimtsev2018-01-18 19:44:04 +0000
committerAlexander Kurtakov2018-01-26 14:19:08 +0000
commit65ca41b1f452e1f1e15f55c0bf09339f72e065eb (patch)
parente55e66e8760fe7f79c6becf09ad7f4519e02d2e5 (diff)
Details: - This makes make_linux.mak independent, i.e the following works: make -f make_linux.mak clean all It does so by assuming default values if they are not set by However, still overrides values for backwards compatibility. I.e, I expect it will work fine with build servers. - I migrated some linux-specific logic from to make_linux.mak * JAVA_HOME detection that I added earlier, * linux specific x86/x86_64 flags - Added a new target: dev_build_install This can be invoked like: export DEV_ECLIPSE="your/eclipse" make -f make_linux.mak clean dev_build_install It builds the launcher/lib and then you can test the output in your dev eclipse. (see target for details.). Test strategy: I've done some very through testing, I'm pretty confident it shouldn't break anything. I've accounted for x86/x86_64 differences. I've added a print statement that prints info about variables: $(info Input info: ....) This line generates the same values for when you run as well as when make_linux is invoked directly. Produced eclipse and work well. Tested on Fedora 27, Wayland, gtk3.22, x86_64. Bug: Change-Id: I07ec8f453acd93d368e5e8f927fa65354da0f68b Signed-off-by: Leo Ufimtsev <>
4 files changed, 93 insertions, 66 deletions
diff --git a/features/org.eclipse.equinox.executable.feature/library/gtk/ b/features/org.eclipse.equinox.executable.feature/library/gtk/
index 5f9906e35..adef8c56e 100644
--- a/features/org.eclipse.equinox.executable.feature/library/gtk/
+++ b/features/org.eclipse.equinox.executable.feature/library/gtk/
@@ -2,19 +2,13 @@
# Building
-To build:
- ./
-This will read the relevant make files.
-To clean:
+ ./
./ clean
# Developer notes:
-To inject into a test eclipse instance for testing:
+See make_linux.mak for info on how to build/test. See dev_build_install target. Common use case:
- cp eclipse (eclipseDir)/eclipse
- cp (eclipseDir)/plugins/org.eclipse.equinox.launcher.<ws>.<os>.<arch>*/
+ export DEV_ECLIPSE="your/dev/eclipse"
+ make -f make_linux.mak clean dev_build_install
diff --git a/features/org.eclipse.equinox.executable.feature/library/gtk/ b/features/org.eclipse.equinox.executable.feature/library/gtk/
index 691eb40ae..f29fc9bb7 100755
--- a/features/org.eclipse.equinox.executable.feature/library/gtk/
+++ b/features/org.eclipse.equinox.executable.feature/library/gtk/
@@ -86,23 +86,10 @@ case $defaultOS in
[ -d /bluebird/teamswt/swt-builddir/JDKs/x86_64/jdk1.5.0 ] && defaultJavaHome="/bluebird/teamswt/swt-builddir/JDKs/x86_64/jdk1.5.0"
- # Automatically figure out where java is installed on the system if it was not found/given otherwise.
- if [ "$defaultJavaHome" = "" ]; then
- DYNAMIC_JAVA_HOME=`readlink -f /usr/bin/java | sed "s:jre/::" | sed "s:bin/java::"`
- if [ -a "${DYNAMIC_JAVA_HOME}include/jni.h" ]; then
- echo "Info: Java automatically set to: $DYNAMIC_JAVA_HOME "
- defaultJavaHome="$DYNAMIC_JAVA_HOME"
- else
- echo "Warning, java not found on system. Please specify JAVA_HOME manually"
- fi
- fi
- OUTPUT_DIR="$EXEC_DIR/bin/$defaultWS/$defaultOS/$defaultOSArch"
i?86 | "x86")
[ -d /bluebird/teamswt/swt-builddir/JDKs/x86/ibm-java2-i386-50 ] && defaultJavaHome="/bluebird/teamswt/swt-builddir/JDKs/x86/ibm-java2-i386-50"
- OUTPUT_DIR="$EXEC_DIR/bin/$defaultWS/$defaultOS/$defaultOSArch"
@@ -265,12 +252,6 @@ elif [ "$defaultOS" = "solaris" ]; then
export M_ARCH
-elif [ "$defaultOS" = "linux" ]; then
- if [ "$defaultOSArch" = "x86_64" ]; then
- # Bug 517013: Avoid using memcpy() to remain compatible with older glibc
- M_CFLAGS="-fno-builtin-memcpy -fno-builtin-memmove"
- export M_CFLAGS
- fi
diff --git a/features/org.eclipse.equinox.executable.feature/library/gtk/make_linux.mak b/features/org.eclipse.equinox.executable.feature/library/gtk/make_linux.mak
index 1167a6329..89c80316d 100644
--- a/features/org.eclipse.equinox.executable.feature/library/gtk/make_linux.mak
+++ b/features/org.eclipse.equinox.executable.feature/library/gtk/make_linux.mak
@@ -2,45 +2,87 @@
# Copyright (c) 2000, 2018 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
+# which accompanies this distribution, and is available at
# Contributors:
# IBM Corporation - initial API and implementation
# Kevin Cornell (Rational Software Corporation)
# Tom Tromey (Red Hat, Inc.)
+# Leo Ufimtsev (Red Hat, Inc) 2018
include ../make_version.mak
# Makefile for creating the GTK eclipse launcher program.
-# This makefile expects the utility "pkg-config" to be in the PATH.
-# This makefile expects the following environment variables set:
+# Can work on it's own or reached from
+# Common invocations:
+# make -f make_linux.mak clean all
+# make -f make_linux.mak clean all install # Install as part of eclipse build.
+# make -f make_linux.mak clean all dev_build_install # For development/testing of launcher, install into your development eclipse, see target below.
+# This makefile expects the utility "pkg-config" to be in the PATH.
+# This makefile expects the following environment variables be set. If they are not set, it will figure out reasonable defaults targeting linux build.
# PROGRAM_OUTPUT - the filename of the output executable
# DEFAULT_OS - the default value of the "-os" switch
# DEFAULT_OS_ARCH - the default value of the "-arch" switch
# DEFAULT_WS - the default value of the "-ws" switch
-# JAVA_HOME - JAVA_HOME for jni headers
-#default value for PROGRAM_OUTPUT
-ifeq ($(PROGRAM_OUTPUT),)
+# JAVA_HOME - JAVA_HOME for jni headers
+# M_ARCH & M_CFLAGS - architecture/cflags for gcc command (if relevant)
+# Environment Variables:
+DEFAULT_OS ?= $(shell uname -s | tr "[:upper:]" "[:lower:]")
+DEFAULT_WS ?= gtk
+DEFAULT_OS_ARCH ?= $(shell uname -m)
+JAVA_HOME ?= $(shell readlink -f /usr/bin/java | sed "s:jre/::" | sed "s:bin/java::")
+PROGRAM_OUTPUT ?= eclipse
+EXEC_DIR ?= ../../../../../rt.equinox.binaries/org.eclipse.equinox.executable
+LIBRARY_DIR ?= $(EXEC_DIR)/../org.eclipse.equinox.launcher.$(DEFAULT_WS).$(DEFAULT_OS).$(DEFAULT_OS_ARCH)
+# Architecture specific Vars:
+# 32 bit specific flag:
+ifeq ($(M_ARCH),)
+ifeq ($(DEFAULT_OS_ARCH),x86)
+M_ARCH ?= -m32
+# 64 bit specific flag:
+ifeq ($(M_CFLAGS),)
+ifeq ($(DEFAULT_OS_ARCH),x86_64)
+# Bug 517013: Avoid using memcpy() to remain compatible with older glibc (not use these flags on 32bit.
+M_CFLAGS ?= -fno-builtin-memcpy -fno-builtin-memmove
-ifeq ($(DEFAULT_JAVA),)
+# Determine launch mode.
+ifeq ($(DEFAULT_OS_ARCH),x86_64)
+else ifeq ($(DEFAULT_OS_ARCH),x86)
+CC ?= gcc
+# Useful to figure out if there is any difference between running and make_linux directly.
+$(info Input info: $(INFO_PROG) $(INFO_ARCH) $(INFO_JAVA) $(INFO_OUT_LIB_DIRS))
# Define the object modules to be compiled and flags.
MAIN_OBJS = eclipseMain.o
COMMON_OBJS = eclipseConfig.o eclipseCommon.o eclipseGtkCommon.o eclipseGtkInit.o
DLL_OBJS = eclipse.o eclipseGtk.o eclipseUtil.o eclipseJNI.o eclipseShm.o eclipseNix.o
+# DLL == ''
#LIBS = `pkg-config --libs-only-L gtk+-2.0` -lgtk-x11-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lgdk-x11-2.0 -lpthread -ldl
LIBS = -lpthread -ldl
@@ -67,27 +109,28 @@ all: $(EXEC) $(DLL)
eclipse.o: ../eclipse.c ../eclipseOS.h ../eclipseCommon.h ../eclipseJNI.h
$(CC) $(CFLAGS) -c ../eclipse.c -o eclipse.o
-eclipseMain.o: ../eclipseUnicode.h ../eclipseCommon.h ../eclipseMain.c
+eclipseMain.o: ../eclipseUnicode.h ../eclipseCommon.h ../eclipseMain.c
+ $(info Starting Build:)
$(CC) $(CFLAGS) -c ../eclipseMain.c -o eclipseMain.o
eclipseCommon.o: ../eclipseCommon.h ../eclipseUnicode.h ../eclipseCommon.c
$(CC) $(CFLAGS) -c ../eclipseCommon.c
eclipseGtkCommon.o: ../eclipseCommon.h ../eclipseOS.h eclipseGtk.h eclipseGtkCommon.c
$(CC) $(CFLAGS) -c eclipseGtkCommon.c -o eclipseGtkCommon.o
eclipseGtkInit.o: ../eclipseCommon.h eclipseGtk.h eclipseGtkInit.c
$(CC) $(CFLAGS) -c eclipseGtkInit.c -o eclipseGtkInit.o
eclipseUtil.o: ../eclipseUtil.c ../eclipseUtil.h ../eclipseOS.h
$(CC) $(CFLAGS) -c ../eclipseUtil.c -o eclipseUtil.o
eclipseJNI.o: ../eclipseJNI.c ../eclipseCommon.h ../eclipseOS.h ../eclipseJNI.h
$(CC) $(CFLAGS) -c ../eclipseJNI.c -o eclipseJNI.o
eclipseConfig.o: ../eclipseConfig.c ../eclipseConfig.h ../eclipseOS.h
$(CC) $(CFLAGS) -c ../eclipseConfig.c -o eclipseConfig.o
eclipseShm.o: ../eclipseShm.h ../eclipseUnicode.h ../eclipseShm.c
$(CC) $(CFLAGS) -c ../eclipseShm.c -o eclipseShm.o
@@ -95,9 +138,11 @@ eclipseNix.o: ../eclipseNix.c
$(CC) $(CFLAGS) -c ../eclipseNix.c -o eclipseNix.o
+ $(info Linking and generating: $(EXEC))
+ $(info Linking and generating: $(DLL))
install: all
@@ -106,4 +151,26 @@ install: all
+ $(info Clean up:)
+# Convienience method to install produced output into a developer's eclipse for testing/development.
+dev_build_install: all
+ifeq "$(origin DEV_ECLIPSE)" "environment"
+ $(info Copying $(EXEC) and $(DLL) into your development eclipse folder:)
+ cp $(EXEC) ${DEV_ECLIPSE}/
+ cp $(DLL) ${DEV_ECLIPSE}/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_*/
+ DEV_ECLIPSE environmental variable is not defined.
+ You can download an integration build eclipse for testing and set DEV_ECLIPSE to point to it's folder
+ as per output of 'pwd'. Note, without trailing forwardslash. Integration build can be downloaded here:
+ See:
+ That way you can automatically build and copy eclipse and into the relevant folders for testing.
+ E.g: you can put something like the following into your .bashrc
+ export DEV_ECLIPSE="/home/YOUR_USER/Downloads/eclipse-SDK-I20YYMMDD-XXXX-linux-gtk-x86_64/eclipse"
diff --git a/features/org.eclipse.equinox.executable.feature/library/gtk/makefile b/features/org.eclipse.equinox.executable.feature/library/gtk/makefile
deleted file mode 100644
index 9cd1a6b8b..000000000
--- a/features/org.eclipse.equinox.executable.feature/library/gtk/makefile
+++ /dev/null
@@ -1,15 +0,0 @@
- ./
- ./ clean
-# For devs:
-# Convienience target to move the launcher and the relevant *.so into your development eclipse folder for testing/verification.
-# Typically, you can download the latest integration build from here:, and use it as your dev eclipse.
- # You should define "DEV_ECLIPSE" to be the directory of your testing eclipse, containing the 'eclipse' executable.
- # I.e the output of 'pwd' (Note: without trailing forward slash).
- # export DEV_ECLIPSE="/home/YOUR_USER/Downloads/eclipse-SDK-I20180115-2000-linux-gtk-x86_64/eclipse"
- cp eclipse ${DEV_ECLIPSE}/
- cp eclipse_*.so ${DEV_ECLIPSE}/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_*/

Back to the top