From: Mathieu Baudier Date: Wed, 8 Mar 2023 16:20:22 +0000 (+0100) Subject: Rebuild ECJ and BND X-Git-Tag: v2.3.12~77 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=0301f5aa84ea0661efa22f83a5f94eac62eac7b9;p=gpl%2Fargeo-tp.git Rebuild ECJ and BND --- diff --git a/Makefile b/Makefile index d343bbf..a919ea9 100644 --- a/Makefile +++ b/Makefile @@ -1,26 +1,30 @@ include sdk.mk -.PHONY: clean all +.PHONY: clean all bootstrap -all: distribution +all: bootstrap distribution BOOTSTRAP_BASE=$(SDK_BUILD_BASE)/bootstrap A2_OUTPUT = $(SDK_BUILD_BASE)/a2 -distribution: bootstrap +distribution: make -C repackage all make -C rebuild all -bootstrap : +bootstrap: + make -C bootstrap bootstrap-download-sources all + +bootstrap-old : mkdir -p $(SDK_BUILD_BASE)/bootstrap wget -c -O $(BOOTSTRAP_BASE)/ecj.jar https://repo1.maven.org/maven2/org/eclipse/jdt/ecj/3.32.0/ecj-3.32.0.jar wget -c -O $(BOOTSTRAP_BASE)/slf4j-api.jar https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar wget -c -O $(BOOTSTRAP_BASE)/bndlib.jar https://repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bndlib/5.3.0/biz.aQute.bndlib-5.3.0.jar clean: - rm -rf $(BOOTSTRAP_BASE) + make -C bootstrap clean make -C repackage clean make -C rebuild clean + clean-origin-cache: rm -rf $(HOME)/.cache/argeo/build diff --git a/bootstrap/Makefile b/bootstrap/Makefile new file mode 100644 index 0000000..c056636 --- /dev/null +++ b/bootstrap/Makefile @@ -0,0 +1,75 @@ +include ../sdk.mk +include ../common.mk + +ECJ_VERSION=4.26 +BND_VERSION=5.3.0 + +ORIGIN_BASE=$(HOME)/.cache/argeo/build/origin +BOOTSTRAP_BASE=$(SDK_BUILD_BASE)/bootstrap + +ECJ_BASE=$(BOOTSTRAP_BASE)/ecj +ECJ_SRC=$(ECJ_BASE)/OSGI-OPT/src + +BNDLIB_BASE=$(BOOTSTRAP_BASE)/bndlib +BNDLIB_SRC=$(BNDLIB_BASE)/OSGI-OPT/src + +bootstrap-download-sources: $(ORIGIN_BASE)/ecjsrc-$(ECJ_VERSION).jar $(ORIGIN_BASE)/bnd-$(BND_VERSION).tar.gz + +$(ORIGIN_BASE)/ecjsrc-$(ECJ_VERSION).jar: + mkdir -p $(ORIGIN_BASE) + wget -c -O $(ORIGIN_BASE)/ecjsrc-$(ECJ_VERSION).jar https://ftp-stud.hs-esslingen.de/Mirrors/eclipse/eclipse/downloads/drops4/R-4.26-202211231800/ecjsrc-$(ECJ_VERSION).jar + +$(ORIGIN_BASE)/bnd-$(BND_VERSION).tar.gz: + mkdir -p $(ORIGIN_BASE) + wget -c -O $(ORIGIN_BASE)/bnd-$(BND_VERSION).tar.gz https://github.com/bndtools/bnd/archive/refs/tags/$(BND_VERSION).REL.tar.gz + +all: ecj-build bndlib-build + make -C org.argeo.tp.build all + +ecj: ecj-build + +ecj-build: + mkdir -p $(ECJ_BASE) + cd $(ECJ_BASE) && jar -xf $(ORIGIN_BASE)/ecjsrc-$(ECJ_VERSION).jar + # remove ant-dependent class + $(RM) $(ECJ_BASE)/org/eclipse/jdt/core/JDTCompilerAdapter.java + # clean up + $(RM) $(ECJ_BASE)/*.jar + $(RM) $(ECJ_BASE)/build.xml + $(RM) $(ECJ_BASE)/ecj.1 + $(RM) -rf $(ECJ_BASE)/scripts + # TODO: keep the service files + $(RM) -rf $(ECJ_BASE)/META-INF + # list sources + find $(ECJ_BASE)/org | grep "\.java" > $(BOOTSTRAP_BASE)/ecj.todo + # copy sources + mkdir -p $(ECJ_SRC) + cp -r $(ECJ_BASE)/org $(ECJ_SRC) + # build + $(JAVA_HOME)/bin/javac -d $(ECJ_BASE) -source 17 -target 17 -Xlint:none @$(BOOTSTRAP_BASE)/ecj.todo + # remove sources + cd $(ECJ_BASE) && find . -name "*.java" -name "*.html" -type f -exec rm -f {} \; + +bndlib-build: ecj-build + # copy sources + cd $(BOOTSTRAP_BASE) && tar -xzf $(ORIGIN_BASE)/bnd-$(BND_VERSION).tar.gz + mkdir -p $(BNDLIB_SRC) + cp -r $(BOOTSTRAP_BASE)/bnd-$(BND_VERSION).REL/aQute.libg/src/* $(BNDLIB_SRC) + cp -r $(BOOTSTRAP_BASE)/bnd-$(BND_VERSION).REL/biz.aQute.bndlib/src/* $(BNDLIB_SRC) + cp -r $(BOOTSTRAP_BASE)/bnd-$(BND_VERSION).REL/biz.aQute.bnd.annotation/src/* $(BNDLIB_SRC) + rm -rf $(BOOTSTRAP_BASE)/bnd-$(BND_VERSION).REL + + # clean up + rm -rf $(BNDLIB_SRC)/aQute/bnd/junit + + # build + $(JAVA_HOME)/bin/java -cp $(ECJ_BASE) org.eclipse.jdt.internal.compiler.batch.Main -nowarn \ + -cp $(BND_CLASSPATH) \ + -source 17 -target 17 \ + $(BNDLIB_SRC) \ + -d $(BNDLIB_BASE) + + +clean: + rm -rf $(BOOTSTRAP_BASE) + make -C org.argeo.tp.build clean diff --git a/bootstrap/org.argeo.tp.build/Makefile b/bootstrap/org.argeo.tp.build/Makefile new file mode 100644 index 0000000..be38fd2 --- /dev/null +++ b/bootstrap/org.argeo.tp.build/Makefile @@ -0,0 +1,22 @@ +include ../../sdk.mk +include ../../common.mk + +.PHONY: clean all osgi + +A2_OUTPUT := $(SDK_BUILD_BASE)/a2 +JVM ?= $(JAVA_HOME)/bin/java + +ARGEO_MAKE := $(JVM) -cp $(BOOTSTRAP_BASE)/ecj:$(BOOTSTRAP_BASE)/bndlib:$(BND_CLASSPATH) $(SDK_SRC_BASE)/sdk/argeo-build/src/org/argeo/build/Make.java + +A2_CATEGORY = org.argeo.tp.build + +all: osgi + +osgi: + cp -r $(BOOTSTRAP_BASE)/ecj/OSGI-OPT/src org.eclipse.jdt.core.compiler.batch + cp -r $(BOOTSTRAP_BASE)/bndlib/OSGI-OPT/src biz.aQute.bndlib + $(ARGEO_MAKE) all --category $(A2_CATEGORY) --bundles org.eclipse.jdt.core.compiler.batch biz.aQute.bndlib + +clean: + $(RM) -rf org.eclipse.jdt.core.compiler.batch/src + $(RM) -rf biz.aQute.bndlib/src \ No newline at end of file diff --git a/bootstrap/org.argeo.tp.build/biz.aQute.bndlib/.gitignore b/bootstrap/org.argeo.tp.build/biz.aQute.bndlib/.gitignore new file mode 100644 index 0000000..668266f --- /dev/null +++ b/bootstrap/org.argeo.tp.build/biz.aQute.bndlib/.gitignore @@ -0,0 +1,2 @@ +/src/ +/bin/ \ No newline at end of file diff --git a/bootstrap/org.argeo.tp.build/biz.aQute.bndlib/bnd.bnd b/bootstrap/org.argeo.tp.build/biz.aQute.bndlib/bnd.bnd new file mode 100644 index 0000000..5932b5f --- /dev/null +++ b/bootstrap/org.argeo.tp.build/biz.aQute.bndlib/bnd.bnd @@ -0,0 +1,6 @@ +major: 5 +minor: 3 +micro: 0 +qualifier: + +Bundle-License: Apache-2.0 diff --git a/bootstrap/org.argeo.tp.build/org.eclipse.jdt.core.compiler.batch/.gitignore b/bootstrap/org.argeo.tp.build/org.eclipse.jdt.core.compiler.batch/.gitignore new file mode 100644 index 0000000..668266f --- /dev/null +++ b/bootstrap/org.argeo.tp.build/org.eclipse.jdt.core.compiler.batch/.gitignore @@ -0,0 +1,2 @@ +/src/ +/bin/ \ No newline at end of file diff --git a/bootstrap/org.argeo.tp.build/org.eclipse.jdt.core.compiler.batch/bnd.bnd b/bootstrap/org.argeo.tp.build/org.eclipse.jdt.core.compiler.batch/bnd.bnd new file mode 100644 index 0000000..c72bda9 --- /dev/null +++ b/bootstrap/org.argeo.tp.build/org.eclipse.jdt.core.compiler.batch/bnd.bnd @@ -0,0 +1,7 @@ +major: 3 +minor: 32 +micro: 0 +qualifier: + +Bundle-License: EPL-2.0 +Main-Class: org.eclipse.jdt.internal.compiler.batch.Main diff --git a/common.mk b/common.mk new file mode 100644 index 0000000..1dec4df --- /dev/null +++ b/common.mk @@ -0,0 +1,10 @@ +BOOTSTRAP_BASE=$(SDK_BUILD_BASE)/bootstrap + +ifneq (,$(wildcard /etc/redhat-release)) +# dnf install slf4j osgi-core osgi-annotation osgi-compendium +BND_CLASSPATH=/usr/share/java/slf4j/slf4j-api.jar:/usr/share/java/osgi-core/osgi.core.jar:/usr/share/java/osgi-annotation/osgi.annotation.jar:/usr/share/java/osgi-compendium/osgi.cmpn.jar +else +# sudo apt install libslf4j-java libosgi-core-java libosgi-annotation-java libosgi-compendium-java +BND_CLASSPATH=/usr/share/java/slf4j-api.jar:/usr/share/java/osgi.core.jar:/usr/share/java/osgi.annotation.jar:/usr/share/java/osgi.cmpn.jar +endif + diff --git a/repackage/Makefile b/repackage/Makefile index e555f39..1400855 100644 --- a/repackage/Makefile +++ b/repackage/Makefile @@ -1,4 +1,6 @@ include ../sdk.mk +include ../common.mk + .PHONY: clean all BOOTSTRAP_BASE=$(SDK_BUILD_BASE)/bootstrap @@ -39,8 +41,9 @@ all: $(BUILD_BASE)/repackaged $(BUILD_BASE)/repackaged : CATEGORIES_TO_REPACKAGE = $(subst $(abspath $(BUILD_BASE))/,, $(subst to-repackage,, $?)) $(BUILD_BASE)/repackaged : $(TODOS_REPACKAGE) - $(JVM) -cp \ - $(BOOTSTRAP_BASE)/bndlib.jar:$(BOOTSTRAP_BASE)/slf4j-api.jar \ + #$(JVM) -cp \ + # $(BOOTSTRAP_BASE)/bndlib.jar:$(BOOTSTRAP_BASE)/slf4j-api.jar + $(JVM) -cp $(A2_OUTPUT)/org.argeo.tp.build/biz.aQute.bndlib.5.3.jar:$(BND_CLASSPATH) \ $(SDK_SRC_BASE)/sdk/argeo-build/src/org/argeo/build/Repackage.java $(A2_OUTPUT) $(CATEGORIES_TO_REPACKAGE) touch $(BUILD_BASE)/repackaged