Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorJonah Graham2019-10-03 21:14:48 +0000
committerJonah Graham2019-11-04 12:19:27 +0000
commit29369a555c9baf53d1273db2ba6742f577262346 (patch)
treeb1ad2594db39326e8e020eac04ad9cfe16488fc7 /native
parent412d926a24a186220484faac893e6c676b0930bd (diff)
downloadorg.eclipse.cdt-29369a555c9baf53d1273db2ba6742f577262346.tar.gz
org.eclipse.cdt-29369a555c9baf53d1273db2ba6742f577262346.tar.xz
org.eclipse.cdt-29369a555c9baf53d1273db2ba6742f577262346.zip
Bug 521515: [releng] Build o.e.cdt.native.serial natives using docker
Steps: 1. Edit and commit change 2. docker run --rm -it -v $(git rev-parse --show-toplevel):/work -w /work/$(git rev-parse --show-prefix) quay.io/eclipse-cdt/cdt-infra-eclipse-full:latest make -C jni rebuild 3. GIT_COMMITTER_DATE=$(git log -1 --pretty=format:%cI -- .) git commit --amend -a --reuse-message=HEAD Change-Id: I9d9a576fd2eb1c5edd874098d08564ecdfa6ba09
Diffstat (limited to 'native')
-rw-r--r--native/org.eclipse.cdt.native.serial/META-INF/MANIFEST.MF2
-rw-r--r--native/org.eclipse.cdt.native.serial/jni/Makefile14
-rw-r--r--native/org.eclipse.cdt.native.serial/jni/Readme.md21
-rwxr-xr-xnative/org.eclipse.cdt.native.serial/os/linux/x86_64/libserial.sobin13408 -> 13192 bytes
-rwxr-xr-xnative/org.eclipse.cdt.native.serial/os/macosx/x86_64/libserial.jnilibbin13756 -> 13476 bytes
-rwxr-xr-xnative/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dllbin126038 -> 380597 bytes
-rw-r--r--native/org.eclipse.cdt.native.serial/pom.xml78
7 files changed, 109 insertions, 6 deletions
diff --git a/native/org.eclipse.cdt.native.serial/META-INF/MANIFEST.MF b/native/org.eclipse.cdt.native.serial/META-INF/MANIFEST.MF
index 1a90e5ed722..9347970cf04 100644
--- a/native/org.eclipse.cdt.native.serial/META-INF/MANIFEST.MF
+++ b/native/org.eclipse.cdt.native.serial/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Serial Port
Bundle-SymbolicName: org.eclipse.cdt.native.serial
-Bundle-Version: 1.1.200.qualifier
+Bundle-Version: 1.1.300.qualifier
Bundle-Vendor: Eclipse CDT
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.eclipse.cdt.serial
diff --git a/native/org.eclipse.cdt.native.serial/jni/Makefile b/native/org.eclipse.cdt.native.serial/jni/Makefile
index 8c07bd926e2..72c59e6e8ac 100644
--- a/native/org.eclipse.cdt.native.serial/jni/Makefile
+++ b/native/org.eclipse.cdt.native.serial/jni/Makefile
@@ -1,5 +1,5 @@
#*******************************************************************************
-# Copyright (c) 2002, 2009 QNX Software Systems and others.
+# Copyright (c) 2002, 2019 QNX Software Systems and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
@@ -25,7 +25,8 @@ UNAME = $(shell uname)
ifeq ($(UNAME),Linux)
LIBS = \
$(OS_DIR)/win32/x86_64/serial.dll \
- $(OS_DIR)/linux/x86_64/libserial.so
+ $(OS_DIR)/linux/x86_64/libserial.so \
+ $(OS_DIR)/macosx/x86_64/libserial.jnilib
else
ifeq ($(UNAME),Darwin)
LIBS = \
@@ -43,9 +44,14 @@ clean :
rebuild: clean all
+# Windows DLLs have a build timestamp in them. This makes it impossible to have reproducible builds.
+# However, x86_64-w64-mingw32-ld on Debian/Ubuntu has a patch that overrides the current date
+# using the SOURCE_DATE_EPOCH environment variable. Therefore we set SOURCE_DATE_EPOCH to a
+# consistent timestamp that can be reproduced. We base it off of the commit timestamp of the
+# most recent git commit in this directory.
$(OS_DIR)/win32/x86_64/serial.dll: serial.c
mkdir -p $(dir $@)
- x86_64-w64-mingw32-gcc -I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/win32" -shared -o $@ serial.c
+ SOURCE_DATE_EPOCH=$(shell git log -1 --pretty=format:%ct -- .) x86_64-w64-mingw32-gcc -I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/win32" -shared -o $@ serial.c
$(OS_DIR)/linux/x86_64/libserial.so: serial.c
mkdir -p $(dir $@)
@@ -57,4 +63,4 @@ $(OS_DIR)/linux/ppc64le/libserial.so: serial.c
$(OS_DIR)/macosx/x86_64/libserial.jnilib: serial.c
mkdir -p $(dir $@)
- clang $(CFLAGS) -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin $(LDFLAGS) -dynamiclib -o $@ serial.c
+ x86_64-apple-darwin17-clang $(CFLAGS) -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin $(LDFLAGS) -dynamiclib -o $@ serial.c
diff --git a/native/org.eclipse.cdt.native.serial/jni/Readme.md b/native/org.eclipse.cdt.native.serial/jni/Readme.md
new file mode 100644
index 00000000000..9e8d9f663bd
--- /dev/null
+++ b/native/org.eclipse.cdt.native.serial/jni/Readme.md
@@ -0,0 +1,21 @@
+### How to rebuild natives.
+
+The goal of these instructions is to have a cross-platform build of the natives in CDT. Using tools in CDT's
+[docker](https://github.com/eclipse-cdt/cdt-infra/blob/master/docker/cdt-infra-eclipse-full/ubuntu-18.04/Dockerfile) build image
+(quay.io/eclipse-cdt/cdt-infra-eclipse-full:latest).
+
+It is fairly straightforward to biuild the natives, run this command:
+
+```
+docker run --rm -it -v $(git rev-parse --show-toplevel):/work -w /work/$(git rev-parse --show-prefix) quay.io/eclipse-cdt/cdt-infra-eclipse-full:latest make -C jni rebuild
+```
+
+However, the challenge is that dll files on Windows have a timestamp in them. To have reproducible builds, we need to have a reproducible
+timestamp. Therefore we use the commit time of the commit to derive a timestamp (See the Makefile for more info). Because we want
+to keep the DLL checked in so that contributors don't need to rebuild it all the time we need a way to have to check in the dll with
+the same commit time. To do this we use GIT_COMMITTER_DATE. So, after editing and committing your change, you need to rebuild one last
+time with the commit date and the commit it without changing the commit date again using:
+
+```
+GIT_COMMITTER_DATE=$(git log -1 --pretty=format:%cI -- .) git commit --amend -a --reuse-message=HEAD
+```
diff --git a/native/org.eclipse.cdt.native.serial/os/linux/x86_64/libserial.so b/native/org.eclipse.cdt.native.serial/os/linux/x86_64/libserial.so
index 268ae8165e2..274eab0d844 100755
--- a/native/org.eclipse.cdt.native.serial/os/linux/x86_64/libserial.so
+++ b/native/org.eclipse.cdt.native.serial/os/linux/x86_64/libserial.so
Binary files differ
diff --git a/native/org.eclipse.cdt.native.serial/os/macosx/x86_64/libserial.jnilib b/native/org.eclipse.cdt.native.serial/os/macosx/x86_64/libserial.jnilib
index 4676dd78dd2..26ce721366e 100755
--- a/native/org.eclipse.cdt.native.serial/os/macosx/x86_64/libserial.jnilib
+++ b/native/org.eclipse.cdt.native.serial/os/macosx/x86_64/libserial.jnilib
Binary files differ
diff --git a/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll b/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll
index e1c1019bfa5..d33554a6afd 100755
--- a/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll
+++ b/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll
Binary files differ
diff --git a/native/org.eclipse.cdt.native.serial/pom.xml b/native/org.eclipse.cdt.native.serial/pom.xml
index d6db49c7dae..de6ac78ae72 100644
--- a/native/org.eclipse.cdt.native.serial/pom.xml
+++ b/native/org.eclipse.cdt.native.serial/pom.xml
@@ -23,12 +23,88 @@
<relativePath>../../pom.xml</relativePath>
</parent>
- <version>1.1.200-SNAPSHOT</version>
+ <version>1.1.300-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.native.serial</artifactId>
<packaging>eclipse-plugin</packaging>
<profiles>
<profile>
+ <id>build-native.all</id>
+ <activation>
+ <property>
+ <name>native</name>
+ <value>all</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>natives</id>
+ <phase>process-resources</phase>
+ <configuration>
+ <target>
+ <exec executable="make" newenvironment="false" failOnError="true" dir="./jni">
+ <arg value="rebuild" />
+ </exec>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>build-native.docker</id>
+ <activation>
+ <property>
+ <name>native</name>
+ <value>docker</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>natives</id>
+ <phase>process-resources</phase>
+ <configuration>
+ <target>
+ <exec executable="docker" newenvironment="false" failOnError="true">
+ <!-- docker run -\-rm -t -v $(git rev-parse -\-show-toplevel):/work -w /work/$(git rev-parse -\-show-prefix) quay.io/eclipse-cdt/cdt-infra-eclipse-full:latest make -C jni rebuild -->
+ <arg value="run" />
+ <arg value="--rm" />
+ <arg value="-t" />
+ <arg value="-v" />
+ <arg value="${project.basedir}/../..:/work" />
+ <arg value="-w" />
+ <arg value="/work/native/org.eclipse.cdt.native.serial" />
+ <arg value="quay.io/eclipse-cdt/cdt-infra-eclipse-full:latest" />
+ <arg value="make" />
+ <arg value="-C" />
+ <arg value="jni" />
+ <arg value="rebuild" />
+ </exec>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
<id>build-native.linux.x86_64</id>
<activation>
<property>

Back to the top