[libnative-platform-java] 02/03: Use the original Makefile to build the package. The multiarch circular build-dependencies is very tricky to handle

Kai-Chung Yan seamlik-guest at moszumanska.debian.org
Thu Nov 10 11:40:39 UTC 2016


This is an automated email from the git hooks/post-receive script.

seamlik-guest pushed a commit to branch master
in repository libnative-platform-java.

commit e8dee97217e16ee05dc50767e721c53010514f49
Author: Kai-Chung Yan (殷啟聰) <seamlikok at gmail.com>
Date:   Thu Nov 10 18:40:02 2016 +0800

    Use the original Makefile to build the package. The multiarch circular build-dependencies is very tricky to handle
---
 debian/Makefile                            | 117 ++++++++++++-----------------
 debian/control                             |   1 -
 debian/libnative-platform-java-doc.javadoc |   2 +-
 debian/libnative-platform-java.poms        |   2 +-
 debian/libnative-platform-jni.install      |   3 +-
 debian/native-platform.pom                 |   8 ++
 debian/patches/series                      |   1 -
 debian/rules                               |  19 ++---
 8 files changed, 69 insertions(+), 84 deletions(-)

diff --git a/debian/Makefile b/debian/Makefile
index 595649e..71e0fda 100644
--- a/debian/Makefile
+++ b/debian/Makefile
@@ -4,83 +4,66 @@
 #  Debian use case for now.
 #  Author: Damien Raude-Morvan <drazzib at debian.org>
 #  Adapted for Fedora by: gil cattaneo <puntogil at libero.it>
-CXX ?= g++
-STRIP ?= strip
-JAVA_HOME ?= /usr/lib/jvm/default-java
-JOPT_JAR ?= /usr/share/java/joptsimple.jar
-JTARGET ?= 1.5
-JSOURCE ?= 1.5
-
-IDIR=src/shared/headers
-MAINCPPDIR=src/main/cpp
-SHAREDCPPDIR=src/shared/cpp
-CURSESCPPDIR=src/curses/cpp
-JSRCDIR=src/main/java
-BUILD=build
-IGEN=$(BUILD)/headers
-JCLASSESDIR=$(BUILD)/classes
-JDOCDIR=$(BUILD)/docs/javadoc
-ODIR=$(BUILD)/binaries
-JAR=$(BUILD)/native-platform.jar
-JAR_ARCH=$(BUILD)/native-platform-linux.jar
+include /usr/share/dpkg/architecture.mk
 
-INCLUDE=-I$(IDIR) -I$(IGEN) -I/usr/include -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
+JAVA_HOME ?= /usr/lib/jvm/default-java
+JAVA_TARGET_VERSION = 1.5
+JAVA_SOURCE_VERSION = 1.5
+BUILD_DIR = debian/out
 
-_OBJ_STD = freebsd.o generic.o generic_posix.o linux.o osx.o posix.o unix_strings.o win.o
-_OBJ_CURSES = curses.o generic.o generic_posix.o osx.o unix_strings.o
-OBJ_STD = $(patsubst %,$(ODIR)/%,$(_OBJ_STD))
-OBJ_CURSES = $(patsubst %,$(ODIR)/%,$(_OBJ_CURSES))
-JAVA_SRC_FILEPATHS = $(shell find $(JSRCDIR) -name "*.java" -print)
-JAVA_SRC_NO_INTERNAL_FILEPATHS = $(shell find $(JSRCDIR) -name "*.java" ! -path "*/internal/*" -print)
+CPPFLAGS += -Isrc/shared/headers \
+            -I/usr/include \
+            -I$(BUILD_DIR) \
+            -I$(JAVA_HOME)/include \
+            -I$(JAVA_HOME)/include/linux
+ifeq ($(DEB_HOST_ARCH_OS),linux)
+  CPPFLAGS += -D_FILE_OFFSET_BITS=64
+endif
 
-.PHONY: clean jar javadoc
+MAIN_CXX_SRC = $(shell find src/main/cpp -name "*.cpp" -print) \
+               $(shell find src/shared/cpp -name "*.cpp" -print)
+CURSES_CXX_SRC = $(shell find src/curses/cpp -name "*.cpp" -print) \
+                 $(shell find src/shared/cpp -name "*.cpp" -print)
+JAVA_SRC = $(shell find src/main/java -name "*.java" -print) \
+           debian/additionalSrc/PosixFile.java
+JAVA_NO_INTERNAL_SRC = $(shell find src/main/java -name "*.java" ! -path "*/internal/*" -print)
 
-build: $(ODIR)/libnative-platform.so $(ODIR)/libnative-platform-curses.so jar javadoc
+.PHONY: clean javadoc build
 
-$(ODIR)/libnative-platform.so: $(OBJ_STD)
-	$(CXX) -shared -fPIC $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^
-	$(STRIP) $@
+build: $(BUILD_DIR)/libnative-platform.so $(BUILD_DIR)/libnative-platform-curses.so $(BUILD_DIR)/native-platform.jar javadoc
 
-$(ODIR)/libnative-platform-curses.so: $(OBJ_CURSES)
-	$(CXX) $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fPIC -o $@ $^ -lcurses
-	$(STRIP) $@
+$(BUILD_DIR)/libnative-platform.so: $(MAIN_CXX_SRC) $(BUILD_DIR)/native.h
+	$(CXX) -shared $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $(MAIN_CXX_SRC)
 
-$(JCLASSESDIR)/%.class: $(JAVA_SRC_FILEPATHS)
-	mkdir -p $(JCLASSESDIR)
-	javac -source $(JTARGET) -target $(JSOURCE) -d $(JCLASSESDIR) -classpath $(JOPT_JAR) $(JAVA_SRC_FILEPATHS)
+$(BUILD_DIR)/libnative-platform-curses.so: $(CURSES_CXX_SRC) $(BUILD_DIR)/native.h
+	$(CXX) -shared $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -lcurses -o $@ $(CURSES_CXX_SRC)
 
-javadoc: $(JAVA_SRC_NO_INTERNAL_FILEPATHS)
-	mkdir -p $(JDOCDIR)
-	javadoc -d $(JDOCDIR) -classpath $(JOPT_JAR) $(JAVA_SRC_NO_INTERNAL_FILEPATHS)
+$(BUILD_DIR)/classes/%.class: $(JAVA_SRC)
+	mkdir --parents $(BUILD_DIR)/classes
+	javac -source $(JAVA_TARGET_VERSION) -target $(JAVA_SOURCE_VERSION) -encoding UTF-8 -d $(BUILD_DIR)/classes $(JAVA_SRC)
 
-jar: $(JCLASSESDIR)/%.class
-	mkdir -p $(JDOCDIR)
-	(cd $(JCLASSESDIR) ; jar cf ../../$(JAR) .)
+javadoc: $(JAVA_NO_INTERNAL_SRC)
+	mkdir --parents $(BUILD_DIR)/javadoc
+	javadoc -d $(BUILD_DIR)/javadoc $^
 
-$(ODIR)/%.o: $(MAINCPPDIR)/*.cpp $(SHAREDCPPDIR)/*.cpp $(CURSESCPPDIR)/*.cpp $(IGEN)/native.h
-	mkdir -p $(ODIR)
-	$(CXX) $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(INCLUDE) -fPIC -c -o $(ODIR)/curses.o src/curses/cpp/curses.cpp
-	$(CXX) $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(INCLUDE) -fPIC -c -o $(ODIR)/freebsd.o src/main/cpp/freebsd.cpp
-	$(CXX) $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(INCLUDE) -fPIC -c -o $(ODIR)/linux.o src/main/cpp/linux.cpp
-	$(CXX) $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(INCLUDE) -fPIC -c -o $(ODIR)/posix.o src/main/cpp/posix.cpp
-	$(CXX) $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(INCLUDE) -fPIC -c -o $(ODIR)/win.o src/main/cpp/win.cpp
-	$(CXX) $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(INCLUDE) -fPIC -c -o $(ODIR)/generic.o src/shared/cpp/generic.cpp
-	$(CXX) $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(INCLUDE) -fPIC -c -o $(ODIR)/generic_posix.o src/shared/cpp/generic_posix.cpp
-	$(CXX) $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(INCLUDE) -fPIC -c -o $(ODIR)/osx.o src/shared/cpp/osx.cpp
-	$(CXX) $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(INCLUDE) -fPIC -c -o $(ODIR)/unix_strings.o src/shared/cpp/unix_strings.cpp
+$(BUILD_DIR)/native-platform.jar: $(BUILD_DIR)/classes/%.class
+	jar cf $@ -C $(BUILD_DIR)/classes .
 
-$(IGEN)/native.h: $(JCLASSESDIR)/%.class
-	mkdir -p $(IGEN)
-	javah -o $(IGEN)/native.h -classpath $(JCLASSESDIR) \
-	net.rubygrapefruit.platform.internal.jni.NativeLibraryFunctions \
-	net.rubygrapefruit.platform.internal.jni.PosixFileFunctions \
-	net.rubygrapefruit.platform.internal.jni.PosixFileSystemFunctions \
-	net.rubygrapefruit.platform.internal.jni.PosixProcessFunctions \
-	net.rubygrapefruit.platform.internal.jni.PosixTerminalFunctions \
-	net.rubygrapefruit.platform.internal.jni.TerminfoFunctions \
-	net.rubygrapefruit.platform.internal.jni.WindowsConsoleFunctions \
-	net.rubygrapefruit.platform.internal.jni.WindowsHandleFunctions \
-	net.rubygrapefruit.platform.internal.jni.WindowsRegistryFunctions
+$(BUILD_DIR)/native.h: $(BUILD_DIR)/classes/%.class
+	javah -o $(BUILD_DIR)/native.h -classpath $(BUILD_DIR)/classes \
+	      net.rubygrapefruit.platform.internal.jni.NativeLibraryFunctions \
+	      net.rubygrapefruit.platform.internal.jni.PosixFileFunctions \
+	      net.rubygrapefruit.platform.internal.jni.PosixFileSystemFunctions \
+	      net.rubygrapefruit.platform.internal.jni.PosixProcessFunctions \
+	      net.rubygrapefruit.platform.internal.jni.PosixTerminalFunctions \
+	      net.rubygrapefruit.platform.internal.jni.TerminfoFunctions \
+	      net.rubygrapefruit.platform.internal.jni.WindowsConsoleFunctions \
+	      net.rubygrapefruit.platform.internal.jni.WindowsHandleFunctions \
+	      net.rubygrapefruit.platform.internal.jni.WindowsRegistryFunctions \
+	      net.rubygrapefruit.platform.internal.jni.WindowsFileFunctions \
+	      net.rubygrapefruit.platform.internal.jni.FileEventFunctions \
+	      net.rubygrapefruit.platform.internal.jni.PosixTypeFunctions
 
 clean:
-	-rm -rf $(BUILD)
+	$(RM) -r $(BUILD_DIR)/javadoc $(BUILD_DIR)/classes
+	$(RM) $(BUILD_DIR)/*.jar $(BUILD_DIR)/*.so $(BUILD_DIR)/native.h
diff --git a/debian/control b/debian/control
index 8546e9d..f9929e9 100644
--- a/debian/control
+++ b/debian/control
@@ -6,7 +6,6 @@ Uploaders: Damien Raude-Morvan <drazzib at debian.org>,
            Kai-Chung Yan <seamlikok at gmail.com>
 Build-Depends: debhelper (>= 10),
                default-jdk-headless | default-jdk (>= 1:1.6),
-               gradle-debian-helper (>= 1.4~),
                javahelper,
                libncurses5-dev,
                maven-repo-helper (>= 1.5~)
diff --git a/debian/libnative-platform-java-doc.javadoc b/debian/libnative-platform-java-doc.javadoc
index 2cfc12b..ac21735 100644
--- a/debian/libnative-platform-java-doc.javadoc
+++ b/debian/libnative-platform-java-doc.javadoc
@@ -1 +1 @@
-build/docs/javadoc     usr/share/doc/libnative-platform-java/api
\ No newline at end of file
+debian/out/javadoc     usr/share/doc/libnative-platform-java/api
\ No newline at end of file
diff --git a/debian/libnative-platform-java.poms b/debian/libnative-platform-java.poms
index 5e6447a..46a2862 100644
--- a/debian/libnative-platform-java.poms
+++ b/debian/libnative-platform-java.poms
@@ -1 +1 @@
-build/debian/native-platform.pom --artifact=build/libs/native-platform-*.jar --java-lib
+debian/native-platform.pom --artifact=debian/out/native-platform.jar --java-lib
diff --git a/debian/libnative-platform-jni.install b/debian/libnative-platform-jni.install
index dd2192e..3e25944 100644
--- a/debian/libnative-platform-jni.install
+++ b/debian/libnative-platform-jni.install
@@ -1,2 +1 @@
-build/libs/nativePlatform/shared/*.so       usr/lib/jni
-build/libs/nativePlatformCurses/shared/*.so usr/lib/jni
\ No newline at end of file
+debian/out/*.so   usr/lib/jni
\ No newline at end of file
diff --git a/debian/native-platform.pom b/debian/native-platform.pom
new file mode 100644
index 0000000..cac4ed1
--- /dev/null
+++ b/debian/native-platform.pom
@@ -0,0 +1,8 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>net.rubygrapefruit</groupId>
+  <artifactId>native-platform</artifactId>
+  <version>0.11</version>
+</project>
\ No newline at end of file
diff --git a/debian/patches/series b/debian/patches/series
index d4feaae..4685e2c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,3 @@
 native_locator_usr_lib_first.patch
 libname.diff
-build_scripts.patch
 PosixFile_rename.patch
diff --git a/debian/rules b/debian/rules
index 2abe6e9..03bfe91 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,22 +1,19 @@
 #!/usr/bin/make -f
 
-export JAVA_HOME := /usr/lib/jvm/default-java
-
-DEB_VERSION=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]+).*,\1,p')
-DEB_DIR=libnative-platform-java-$(DEB_VERSION)
-VERSION=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]+).*[+~]git([0-9a-z]+).*,\1,p')
-INDEP_DIR := net/rubygrapefruit/native-platform
 export DEB_CFLAGS_MAINT_APPEND = -fPIC
+export DEB_CXXFLAGS_MAINT_APPEND = -fPIC
 export DEB_LDFLAGS_MAINT_APPEND = -fPIC
 
 %:
-	dh $@ --buildsystem=gradle --with maven-repo-helper,javahelper
+	dh $@ --with maven-repo-helper,javahelper
 
-override_dh_auto_build-arch:
-	dh_auto_build -- nativePlatformSharedLibrary nativePlatformCursesSharedLibrary --project-prop release
+override_dh_auto_build:
+	mkdir --parents debian/tmp
+	make -f debian/Makefile build
 
-override_dh_auto_build-indep:
-	dh_auto_build -- jar javadoc --project-prop release -x :testApp:jar -x :testApp:javadoc
+override_dh_auto_clean:
+	dh_auto_clean
+	$(RM) -r debian/out
 
 get-orig-source:
 	uscan --download-current-version --force-download --repack --compression xz
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libnative-platform-java.git



More information about the pkg-java-commits mailing list