|
| 1 | +# To use this file, run: |
| 2 | +# |
| 3 | +# $ make CONFIGURE_FLAGS="-Dplugin.path=/path/to/your/eclipse/plugins" |
| 4 | +# |
| 5 | +# For example, on Debian GNU/Linux: |
| 6 | +# |
| 7 | +# $ make CONFIGURE_FLAGS="-Dplugin.path=/usr/lib/eclipse:/usr/share/eclipse/dropins/jdt" |
| 8 | +# |
| 9 | +# You can also add e.g. "-DforceContextQualifier=none" to make the jars be |
| 10 | +# output under a stable filename. |
| 11 | +# |
| 12 | +# Due to https://github.com/zhourenjian/java2script/issues/7 you may need to |
| 13 | +# run this using xvfb https://packages.debian.org/sid/xvfb |
| 14 | +# |
| 15 | +CONFIGURE_FLAGS += |
| 16 | +CORE_FLAGS += -DjavacFailOnError=true |
| 17 | +INCUBATOR_FLAGS += -DjavacFailOnError=true -DjavacSource=1.6 -DjavacTarget=1.6 |
| 18 | + |
| 19 | +# Order is important; dependencies must go earlier. |
| 20 | +CORE_PLUGINS = net.sf.j2s.core net.sf.j2s.ajax net.sf.j2s.ui net.sf.j2s.lib |
| 21 | +INCUBATOR_PLUGINS = net.sf.j2s.ui.template.velocity net.sf.j2s.ui.cmdline |
| 22 | +CORE_J2SLIB = net.sf.j2s.ajax net.sf.j2s.java.core net.sf.j2s.java.org.eclipse.swt |
| 23 | + |
| 24 | +BUILD_WORKSPACE :=$(PWD)/autobuild |
| 25 | +ECLIPSE_AUTO = eclipse\ |
| 26 | +-configuration$(BUILD_WORKSPACE)/configuration\ |
| 27 | +-user$(BUILD_WORKSPACE)\ |
| 28 | +-data$(BUILD_WORKSPACE)\ |
| 29 | +-nosplash -clean |
| 30 | + |
| 31 | +ECLIPSE_ANT =$(ECLIPSE_AUTO)\ |
| 32 | +-application org.eclipse.ant.core.antRunner |
| 33 | +ECLIPSE_ANT_BUILD =$(ECLIPSE_ANT) build.update.jar |
| 34 | +ECLIPSE_ANT_CLEAN = if [ -f build.xml ]; then\ |
| 35 | +$(ECLIPSE_ANT) clean;\ |
| 36 | +rm -rf build.xml javaCompiler...args;\ |
| 37 | +fi |
| 38 | +ECLIPSE_J2S =$(ECLIPSE_AUTO)\ |
| 39 | +-application net.sf.j2s.ui.cmdlineApi |
| 40 | + |
| 41 | +all: build-libs |
| 42 | + |
| 43 | +configure: |
| 44 | +$(ECLIPSE_ANT) -f configure.xml$(CONFIGURE_FLAGS) |
| 45 | + |
| 46 | +build-plugins: configure |
| 47 | +set -e;foriin$(CORE_PLUGINS:%=sources/%);do \ |
| 48 | +(cd$$i&&$(ECLIPSE_ANT_BUILD)$(CORE_FLAGS); )\ |
| 49 | +done |
| 50 | +set -e;foriin$(INCUBATOR_PLUGINS:%=incubator/%);do \ |
| 51 | +(cd$$i&&$(ECLIPSE_ANT_BUILD)$(INCUBATOR_FLAGS); )\ |
| 52 | +done |
| 53 | + |
| 54 | +local-install-plugins: build-plugins |
| 55 | +$(MAKE) DESTDIR=$(BUILD_WORKSPACE) eclipsedir= install-plugins |
| 56 | +mkdir -p$(BUILD_WORKSPACE)/features |
| 57 | +touch$(BUILD_WORKSPACE)/artifacts.xml |
| 58 | +$(ECLIPSE_AUTO) -initialize |
| 59 | + |
| 60 | +build-libs: local-install-plugins |
| 61 | +set -e;foriin$(CORE_J2SLIB);do \ |
| 62 | +$(ECLIPSE_J2S) -cmd build -path$$PWD/sources/$$i;\ |
| 63 | +done |
| 64 | +mkdir -p sources/net.sf.j2s.lib/bin sources/net.sf.j2s.lib/j2slib |
| 65 | +cd sources/net.sf.j2s.lib/bin&& jar xf ../library.jar |
| 66 | +cd sources/net.sf.j2s.lib&& ant -f build/build.xml |
| 67 | +cd sources/net.sf.j2s.lib&& zip -r j2slib.zip j2slib |
| 68 | + |
| 69 | +clean: |
| 70 | +foriin$(INCUBATOR_PLUGINS:%=incubator/%);do \ |
| 71 | +(cd$$i&&$(ECLIPSE_ANT_CLEAN); )\ |
| 72 | +done |
| 73 | +foriin$(CORE_PLUGINS:%=sources/%);do \ |
| 74 | +(cd$$i&&$(ECLIPSE_ANT_CLEAN); )\ |
| 75 | +done |
| 76 | +rm -rf$(BUILD_WORKSPACE)/.metadata |
| 77 | + |
| 78 | +prefix ?= /usr/local |
| 79 | +eclipsedir ?=$(prefix)/share/eclipse |
| 80 | +datadir ?=$(prefix)/share/java2script |
| 81 | +pluginsdir ?=$(eclipsedir)/plugins |
| 82 | + |
| 83 | +install-plugins: |
| 84 | +test -z"$(DESTDIR)$(pluginsdir)"|| mkdir -p"$(DESTDIR)$(pluginsdir)" |
| 85 | +install -t"$(DESTDIR)$(pluginsdir)"\ |
| 86 | +$(join$(CORE_PLUGINS:%=sources/%/),$(CORE_PLUGINS:%=%_2.0.0.jar))\ |
| 87 | +$(join$(INCUBATOR_PLUGINS:%=incubator/%/),$(INCUBATOR_PLUGINS:%=%_1.0.0.*.jar)) |
| 88 | + |
| 89 | +install: install-plugins |
| 90 | +test -z"$(DESTDIR)$(datadir)"|| mkdir -p"$(DESTDIR)$(datadir)" |
| 91 | +install -t"$(DESTDIR)$(datadir)"\ |
| 92 | + sources/net.sf.j2s.lib/j2slib.zip |
| 93 | + |
| 94 | +.PHONY: all configure build-plugins local-install-plugins build-libs clean install-plugins install |