Skip to content

Commit

Permalink
[Build] Complete 'install' and 'clean' targets in native make files
Browse files Browse the repository at this point in the history
- Copy the launcher library too. To enable that introduce more specific
environment variables for their different location.
- Complete the list of files that have to be deleted in a 'clean'
- Add documentation about how to build the native binaries.
  • Loading branch information
HannesWell committed Apr 8, 2024
1 parent b327cae commit f289d49
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 36 deletions.
20 changes: 20 additions & 0 deletions features/org.eclipse.equinox.executable.feature/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
This feature contains the eclipse executables and includes the equinox launcher bundle and its fragments.
It also host the native C source files to build the executable and launcher binaries for all supported platforms.

## Building the native executable and launcher binaries

To just build the native binaries navigate to the `library/<window-system>` sub-directory of interest and run
- `./build.sh` for Linux or MacOS
- `.\build.bat` for Windows.

For the full setup, which is required to run the Maven build or the equinox.launcher.tests
1. Clone the [`equinox.binaries`](https://github.com/eclipse-equinox/equinox.binaries.git) repository co-located to this repository.
2. Run from the `library/<window-system>` sub-directory matching the platform of interest
- `./build.sh install` for Linux or MacOS
- `.\build.bat install` for Windows

The `install` target additionally moves the just built binaries into the `equinox.binaries` repository clone.

The environment variable `BINARIES_DIR` can be set to specify an alternative path of the `equinox.binaries` repository to which the built binaries are moved.
To specify the exact directory where the native executable or launcher library is moved, set the variable `EXE_OUTPUT_DIR` respectively `LIB_OUTPUT_DIR`.
For more options and details see the `build.sh/bat` files and corresponding make-files.
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ PROGRAM_OUTPUT="$programOutput"
DEFAULT_OS="$defaultOS"
DEFAULT_WS="$defaultWS"
DEPLOYMENT_TARGET=11.0
EXEC_DIR=../../../../../rt.equinox.binaries/org.eclipse.equinox.executable
SDKROOT_PATH="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
if [ "$BINARIES_DIR" = "" ]; then BINARIES_DIR="../../../../../rt.equinox.binaries"; fi

if [ "$defaultOSArch" == "arm64" ] || [ "$defaultOSArch" == "aarch64" ]
then
Expand All @@ -73,7 +72,8 @@ else
DEFAULT_OS_ARCH="$defaultOSArch"
fi

PROGRAM_OUTPUT_DIR="$EXEC_DIR/bin/$defaultWS/$defaultOS/$DEFAULT_OS_ARCH/Eclipse.app/Contents/MacOS"
if [ "$EXE_OUTPUT_DIR" = "" ]; then EXE_OUTPUT_DIR="$BINARIES_DIR/org.eclipse.equinox.executable/bin/$defaultWS/$defaultOS/$DEFAULT_OS_ARCH/Eclipse.app/Contents/MacOS"; fi
if [ "$LIB_OUTPUT_DIR" = "" ]; then LIB_OUTPUT_DIR="$BINARIES_DIR/org.eclipse.equinox.launcher.$defaultWS.$defaultOS.$DEFAULT_OS_ARCH"; fi

# /System/Library/Frameworks/JavaVM.framework/Headers does not exist anymore on Yosemite
if [ -e /System/Library/Frameworks/JavaVM.framework/Headers ]; then
Expand All @@ -84,14 +84,9 @@ fi

ARCHS="-arch $defaultOSArch"

export PROGRAM_OUTPUT DEFAULT_OS DEFAULT_OS_ARCH DEFAULT_WS ARCHS PROGRAM_OUTPUT_DIR JAVA_HEADERS
export PROGRAM_OUTPUT DEFAULT_OS DEFAULT_OS_ARCH DEFAULT_WS ARCHS JAVA_HEADERS EXE_OUTPUT_DIR LIB_OUTPUT_DIR
export MACOSX_DEPLOYMENT_TARGET=$DEPLOYMENT_TARGET

# Check if MacOSX SDK exists at SDKROOT_PATH before exporting it.
if [ -d $SDKROOT_PATH ]; then
export SDKROOT=$SDKROOT_PATH
fi

if [ "$extraArgs" != "" ]; then
make -f $makefile $extraArgs
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ include ../make_version.mak
# 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
# EXE_OUTPUT_DIR - the location into which the executable is installed (only used in 'install' target)
# LIB_OUTPUT_DIR - the location into which the launcher library is installed (only used in 'install' target)

#default value for PROGRAM_OUTPUT
ifeq ($(PROGRAM_OUTPUT),)
Expand Down Expand Up @@ -86,7 +88,12 @@ $(DLL): $(DLL_OBJS) $(COMMON_OBJS)
$(CC) -bundle -o $(DLL) $(ARCHS) $(DLL_OBJS) $(COMMON_OBJS) $(LIBS)

install: all
cp -v $(EXEC) $(PROGRAM_OUTPUT_DIR)
$(info Install into: EXE_OUTPUT_DIR:$(EXE_OUTPUT_DIR) LIB_OUTPUT_DIR:$(LIB_OUTPUT_DIR))
mkdir -p $(EXE_OUTPUT_DIR)
mv $(EXEC) $(EXE_OUTPUT_DIR)
mkdir -p $(LIB_OUTPUT_DIR)
rm -f $(LIB_OUTPUT_DIR)/eclipse_*.so
mv $(DLL) $(LIB_OUTPUT_DIR)
rm -f $(EXEC) $(OBJS)

clean:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ programOutput="eclipse"
defaultOS=""
defaultOSArch=""
defaultWS="gtk"
EXEC_DIR=../../../../../rt.equinox.binaries/org.eclipse.equinox.executable
if [ "$BINARIES_DIR" = "" ]; then BINARIES_DIR="../../../../../rt.equinox.binaries"; fi
defaultJava=DEFAULT_JAVA_JNI
defaultJavaHome=""
javaHome=""
Expand Down Expand Up @@ -97,22 +97,19 @@ case $defaultOS in
defaultJava=DEFAULT_JAVA_EXEC
#[ -d /bluebird/teamswt/swt-builddir/JDKs/PPC64LE/ibm-java2-ppc64le-50 ] && defaultJavaHome="/bluebird/teamswt/swt-builddir/JDKs/PPC64LE/ibm-java2-ppc64le-50"
defaultJavaHome=`readlink -f /usr/bin/java | sed "s:jre/bin/java::"`
OUTPUT_DIR="$EXEC_DIR/bin/$defaultWS/$defaultOS/$defaultOSArch"
;;
"s390x")
defaultOSArch="s390x"
defaultJava=DEFAULT_JAVA_EXEC
OUTPUT_DIR="$EXEC_DIR/contributed/$defaultWS/$defaultOS/$defaultOSArch"
EXE_OUTPUT_DIR="$BINARIES_DIR/org.eclipse.equinox.executable/contributed/$defaultWS/$defaultOS/$defaultOSArch"
;;
"aarch64")
"aarch64")
defaultOSArch="aarch64"
defaultJava=DEFAULT_JAVA_EXEC
OUTPUT_DIR="$EXEC_DIR/bin/$defaultWS/$defaultOS/$defaultOSArch"
;;
"loongarch64")
"loongarch64")
defaultOSArch="loongarch64"
defaultJava=DEFAULT_JAVA_EXEC
OUTPUT_DIR="$EXEC_DIR/bin/$defaultWS/$defaultOS/$defaultOSArch"
;;
*)
echo "*** Unknown MODEL <${MODEL}>"
Expand Down Expand Up @@ -151,10 +148,10 @@ elif [ "$defaultOSArch" = "s390x" ]; then
fi
fi

LIBRARY_DIR="$EXEC_DIR/../org.eclipse.equinox.launcher.$defaultWS.$defaultOS.$defaultOSArch"
OUTPUT_DIR="$EXEC_DIR/bin/$defaultWS/$defaultOS/$defaultOSArch"
if [ "$EXE_OUTPUT_DIR" = "" ]; then EXE_OUTPUT_DIR="$BINARIES_DIR/org.eclipse.equinox.executable/bin/$defaultWS/$defaultOS/$defaultOSArch"; fi
if [ "$LIB_OUTPUT_DIR" = "" ]; then LIB_OUTPUT_DIR="$BINARIES_DIR/org.eclipse.equinox.launcher.$defaultWS.$defaultOS.$defaultOSArch"; fi

export OUTPUT_DIR PROGRAM_OUTPUT DEFAULT_OS DEFAULT_OS_ARCH DEFAULT_WS DEFAULT_JAVA LIBRARY_DIR
export PROGRAM_OUTPUT DEFAULT_OS DEFAULT_OS_ARCH DEFAULT_WS DEFAULT_JAVA EXE_OUTPUT_DIR LIB_OUTPUT_DIR

# If the OS is supported (a makefile exists)
if [ "$makefile" != "" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ include ../make_version.mak
# 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
# JAVA_HOME - JAVA_HOME for jni headers
# M_ARCH & M_CFLAGS - architecture/cflags for gcc command (if relevant)
# EXE_OUTPUT_DIR - the location into which the executable is installed (only used in 'install' target)
# LIB_OUTPUT_DIR - the location into which the launcher library is installed (only used in 'install' target)

# Environment Variables:
DEFAULT_OS ?= $(shell uname -s | tr "[:upper:]" "[:lower:]")
Expand All @@ -41,10 +43,7 @@ JAVA_HOME ?= $(shell readlink -f /usr/bin/java | sed "s:jre/::" | sed "s:bin/jav
PROGRAM_OUTPUT ?= eclipse
PROGRAM_LIBRARY = $(PROGRAM_OUTPUT)_$(LIB_VERSION).so

EXEC_DIR ?= ../../../../../rt.equinox.binaries/org.eclipse.equinox.executable
OUTPUT_DIR ?= $(EXEC_DIR)/bin/$(DEFAULT_WS)/$(DEFAULT_OS)/$(DEFAULT_OS_ARCH)
LIBRARY_FRAGMENT_NAME ?= org.eclipse.equinox.launcher.$(DEFAULT_WS).$(DEFAULT_OS).$(DEFAULT_OS_ARCH)
LIBRARY_DIR ?= $(EXEC_DIR)/../$(LIBRARY_FRAGMENT_NAME)

# 64 bit specific flag:
ifeq ($(M_CFLAGS),)
Expand All @@ -65,8 +64,7 @@ CC ?= gcc
INFO_PROG=CC:$(CC) PROGRAM_OUTPUT:$(PROGRAM_OUTPUT) PROGRAM_LIBRARY:$(PROGRAM_LIBRARY) #
INFO_ARCH=DEFAULT_OS:$(DEFAULT_OS) DEFAULT_WS:$(DEFAULT_WS) DEFAULT_OS_ARCH:$(DEFAULT_OS_ARCH) M_ARCH:$(M_ARCH) M_CFLAGS:$(M_CFLAGS) #
INFO_JAVA=JAVA_HOME:$(JAVA_HOME) DEFAULT_JAVA:$(DEFAULT_JAVA) #
INFO_OUT_LIB_DIRS=OUTPUT_DIR:$(OUTPUT_DIR) LIBRARY_DIR:$(LIBRARY_DIR) #
$(info Input info: $(INFO_PROG) $(INFO_ARCH) $(INFO_JAVA) $(INFO_OUT_LIB_DIRS))
$(info Input info: $(INFO_PROG) $(INFO_ARCH) $(INFO_JAVA))

# Define the object modules to be compiled and flags.
MAIN_OBJS = eclipseMain.o
Expand Down Expand Up @@ -138,9 +136,13 @@ $(DLL): $(DLL_OBJS) $(COMMON_OBJS)
$(CC) $(LFLAGS) -o $(DLL) $(DLL_OBJS) $(COMMON_OBJS) $(LIBS)

install: all
cp $(EXEC) $(OUTPUT_DIR)
cp $(DLL) $(LIBRARY_DIR)
rm -f $(EXEC) $(DLL) $(MAIN_OBJS) $(COMMON_OBJS) $(DLL_OBJS)
$(info Install into: EXE_OUTPUT_DIR:$(EXE_OUTPUT_DIR) LIB_OUTPUT_DIR:$(LIB_OUTPUT_DIR))
mkdir -p $(EXE_OUTPUT_DIR)
mv $(EXEC) $(EXE_OUTPUT_DIR)
mkdir -p $(LIB_OUTPUT_DIR)
rm -f $(LIB_OUTPUT_DIR)/eclipse_*.so
mv $(DLL) $(LIB_OUTPUT_DIR)
rm -f $(MAIN_OBJS) $(COMMON_OBJS) $(DLL_OBJS)

clean:
$(info Clean up:)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ set PROGRAM_LIBRARY=%programLibrary%
set DEFAULT_OS=%defaultOS%
set DEFAULT_OS_ARCH=%defaultOSArch%
set DEFAULT_WS=%defaultWS%
set EXEC_DIR=..\..\.\..\..\rt.equinox.binaries\org.eclipse.equinox.executable
set OUTPUT_DIR=%EXEC_DIR%\bin\%defaultWS%\%defaultOS%\%defaultOSArch%
set JAVA_HOME=%javaHome%
IF "%BINARIES_DIR%"=="" set "BINARIES_DIR=..\..\..\..\..\rt.equinox.binaries"
IF "%EXE_OUTPUT_DIR%"=="" set "EXE_OUTPUT_DIR=%BINARIES_DIR%\org.eclipse.equinox.executable\bin\%defaultWS%\%defaultOS%\%defaultOSArch%"
IF "%LIB_OUTPUT_DIR%"=="" set "LIB_OUTPUT_DIR=%BINARIES_DIR%\org.eclipse.equinox.launcher.%defaultWS%.%defaultOS%.%defaultOSArch%"

rem --------------------------
rem Run nmake to build the executable.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
# DEFAULT_OS_ARCH - the default value of the "-arch" switch
# DEFAULT_WS - the default value of the "-ws" switch
# JAVA_HOME - the location of the Java for JNI includes
# EXE_OUTPUT_DIR - the location into which the executable is installed (only used in 'install' target)
# LIB_OUTPUT_DIR - the location into which the launcher library is installed (only used in 'install' target)
NODEBUG=1

APPVER=4.0
Expand Down Expand Up @@ -95,7 +97,7 @@ eclipseJNI.obj: ../eclipseCommon.h ../eclipseOS.h ../eclipseJNI.c

eclipseShm.obj: ../eclipseShm.h ../eclipseUnicode.h ../eclipseShm.c
cl $(DEBUG) $(wcflags) $(cvarsmt) /Fo$*.obj ../eclipseShm.c

$(EXEC): $(MAIN_OBJS) $(COMMON_OBJS) $(RES)
link $(LFLAGS) -out:$(PROGRAM_OUTPUT) $(MAIN_OBJS) $(COMMON_OBJS) $(RES) $(LIBS)

Expand All @@ -109,11 +111,17 @@ $(RES): $(PROGRAM_NAME).rc
rc -r -fo $(RES) eclipse.rc

install: all
copy $(EXEC) $(OUTPUT_DIR)
del -f $(EXEC) $(MAIN_OBJS) $(DLL_OBJS) $(COMMON_OBJS) $(RES)

@echo Install into: EXE_OUTPUT_DIR:$(EXE_OUTPUT_DIR) LIB_OUTPUT_DIR:$(LIB_OUTPUT_DIR))
-1cmd /c "mkdir $(EXE_OUTPUT_DIR)"
move /y $(EXEC) $(EXE_OUTPUT_DIR)
move /y $(CONSOLE) $(EXE_OUTPUT_DIR)
-1cmd /c "mkdir $(LIB_OUTPUT_DIR)"
del $(LIB_OUTPUT_DIR)\eclipse_*.dll
move /y $(DLL) $(LIB_OUTPUT_DIR)
del $(MAIN_OBJS) $(MAIN_CONSOLE_OBJS) $(DLL_OBJS) $(COMMON_OBJS) $(RES) eclipse_*.exp eclipse_*.lib

clean:
del $(EXEC) $(DLL) $(MAIN_OBJS) $(MAIN_CONSOLE_OBJS) $(DLL_OBJS) $(COMMON_OBJS) $(RES)
del $(EXEC) $(CONSOLE) $(DLL) $(MAIN_OBJS) $(MAIN_CONSOLE_OBJS) $(DLL_OBJS) $(COMMON_OBJS) $(RES) eclipse_*.exp eclipse_*.lib

# Convienience method to install produced output into a developer's eclipse for testing/development.
dev_build_install: all
Expand Down

0 comments on commit f289d49

Please sign in to comment.