1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
|
#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_GNU_CPU ?= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
DEB_HOST_GNU_OS ?= $(shell dpkg-architecture -qDEB_HOST_GNU_OS)
ifeq ($(DEB_HOST_GNU_CPU),i486)
DEB_HOST_GNU_CPU = i386
endif
GCC_VERSION = 4.1
JAVA_VERSION = 1.4.2
BUILD_VERSION = 0
distribution := $(shell lsb_release -is)
GCJ = gcj-$(GCC_VERSION)
origin_name = gcj-$(GCC_VERSION)
jvmroot = usr/lib/jvm
sdk_dir = java-$(JAVA_VERSION)-$(origin_name)-$(JAVA_VERSION).$(BUILD_VERSION)
jre_dir = $(sdk_dir)/jre
sdk_path = $(jvmroot)/$(sdk_dir)
jre_path = $(jvmroot)/$(jre_dir)
sdk32_path = usr/lib32/jvm/$(sdk_dir)
jre32_path = usr/lib32/jvm/$(jre_dir)
p_jre = java-gcj-compat
p_sdk = java-gcj-compat-dev
p_web = java-gcj-compat-plugin
p_ia32 = ia32-java-gcj-compat
d_sdk = debian/java-gcj-compat-dev
d_jre = debian/java-gcj-compat
d_web = debian/java-gcj-compat-plugin
d_ia32 = debian/ia32-java-gcj-compat
jre_tools = jar java keytool rmiregistry
jdk_tools = appletviewer jarsigner javac javadoc javah rmic
priority = 1041
dev_depends = ecj-bootstrap (>= 3.2) | ecj
dev_recommends = ecj-bootstrap-gcj
ifeq (,$(findstring $(DEB_HOST_ARCH),arm))
dev_depends = ecj-bootstrap-gcj (>= 3.2)
dev_recommends =
endif
ifeq ($(distribution),Debian)
plugin_depends = gappletviewer-$(GCC_VERSION)
with_gfdl_docs := no
else
plugin_depends = gcjwebplugin-$(GCC_VERSION)
with_gfdl_docs := no
ifeq ($(DEB_HOST_ARCH),amd64)
with_ia32 = yes
endif
endif
ifneq ($(with_ia32),yes)
dh_args = -N$(p_ia32)
endif
PY_VERSION := $(shell python -c 'import sys; print sys.version[:3]')
PY_INTERPRETER := /usr/bin/python$(PY_VERSION)
packaging-files:
for f in debian/*.in; do \
case "$$f" in debian/control.in) continue; esac; \
f2=$$(echo $$f | sed 's/JB/$(basename)/;s/\.in$$//'); \
sed -e 's/@vendor@/FSF/g' \
-e 's/@basename@/$(sdk_dir)/g' \
-e 's,@basedir@,/$(jvmroot)/java-gcj,g' \
-e 's/@priority@/$(priority)/g' \
-e 's/@BV@/$(GCC_VERSION)/g' \
-e 's/@jre_tools@/$(jre_tools)/g' \
-e 's/@jdk_tools@/$(jdk_tools)/g' \
-e 's/@GFDL@/$(if $(filter-out yes,$(with_gfdl_docs)),\#)/g' \
$$f > $$f2; \
done
build: build-stamp
build-stamp: configure-stamp
dh_testdir
$(MAKE)
touch build-stamp
configure: configure-stamp
configure-stamp:
dh_testdir
JAR=fastjar ./configure \
--with-origin-name=$(origin_name) \
--with-gcc-suffix=-$(GCC_VERSION) \
--with-arch-directory=$(DEB_HOST_GNU_CPU) \
--disable-symlinks \
--with-classpath-security=/usr/lib/security/classpath.security \
--with-security-directory=/etc/java/security/security.d \
--prefix=/usr
touch configure-stamp
clean:
dh_testdir
dh_testroot
rm -f *-stamp
-$(MAKE) distclean
rm -f javadoc config.log
rm -rf build
rm -f debian/dh_nativejava.1
for f in debian/*.in; do \
f2=$$(echo $$f | sed 's/JB/$(basename)/;s/\.in$$//'); \
case "$$f2" in debian/control) continue; esac; \
rm -f $$f2; \
done
dh_clean
install: build packaging-files
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs -p$(p_sdk) \
$(sdk_path)/include/linux \
$(sdk_path)/man/man1
dh_installdirs -p$(p_jre) \
usr/bin \
$(sdk_path)/bin \
$(sdk_path)/man/man1 \
$(jre_path)/lib/$(DEB_HOST_GNU_CPU) \
$(jre_path)/lib/security \
/etc/java/security/security.d \
/usr/lib/security
dh_installdirs -p$(p_web) \
usr/lib/mozilla/plugins \
usr/lib/mozilla-firefox/plugins \
usr/lib/mozilla-snapshot/plugins \
usr/lib/iceweasel/plugins \
usr/lib/iceape/plugins \
$(jre_path)/lib
$(MAKE) install DESTDIR=`pwd`/$(d_sdk)
rm -rf $(d_sdk)/usr/local
: # remove, in libgcj-common
rm -f $(d_sdk)/usr/bin/rebuild-gcj-db
: # split jre and sdk
dh_movefiles -p$(p_jre) --sourcedir=$(d_sdk) \
$(jre_path) \
$(sdk_path)/bin/jar \
$(sdk_path)/bin/java \
$(sdk_path)/bin/keytool \
$(sdk_path)/bin/rmiregistry \
ln -s $(sdk_dir) $(d_jre)/$(jvmroot)/java-gcj
: # add include links
for i in jni.h jni_md.h jawt.h jawt_md.h gcj; do \
dh_link -p $(p_sdk) \
`$(GCJ) -print-file-name=include/$$i` \
/$(sdk_path)/include/$$i || exit 1; \
done
dh_link -p $(p_sdk) \
`$(GCJ) -print-file-name=include/jawt_md.h` \
/$(sdk_path)/include/linux/jawt_md.h
: # add library links
for i in libgij.so libgcj.so libgcj-tools.so; do \
dh_link -p $(p_sdk) \
`$(GCJ) -print-file-name=$$i` \
/$(sdk_path)/lib/$$i || exit 1; \
done
dh_link -p $(p_sdk) \
/usr/lib/$(GCJ)/libjawt.so /$(sdk_path)/lib/libjawt.so
: # additional sdk tools
dh_link -p $(p_sdk) \
usr/bin/$(GCJ) $(sdk_path)/bin/gcj \
usr/bin/gjdoc $(sdk_path)/bin/javadoc \
usr/bin/gjarsigner-$(GCC_VERSION) $(sdk_path)/bin/jarsigner \
usr/bin/gappletviewer-$(GCC_VERSION) $(sdk_path)/bin/appletviewer
: # sdk manual pages
dh_link -p $(p_sdk) \
usr/share/man/man1/gjdoc.1.gz \
$(sdk_path)/man/man1/javadoc.1.gz \
usr/share/man/man1/gcjh-$(GCC_VERSION).1.gz \
$(sdk_path)/man/man1/javah.1.gz \
usr/share/man/man1/grmic-$(GCC_VERSION).1.gz \
$(sdk_path)/man/man1/rmic.1.gz
# absolute symlinks needed
ln -sf /usr/share/man/man1/ecj.1.gz \
$(d_sdk)/$(sdk_path)/man/man1/javac.1.gz
ln -sf /usr/bin/ecj \
$(d_sdk)/$(sdk_path)/bin/javac
# we don't want a dependency on libgcj6-src, moved the link to libgcj6-src.
# dh_link -p $(p_sdk) \
# /usr/share/java/libgcj-src-$(GCC_VERSION).zip \
# /$(sdk_path)/src.zip
ifneq (,$(findstring $(DEB_HOST_ARCH),arm hppa))
# : # unconditionally use ecj-bootstrap-gcj on arm and hppa, ecj doesn't work with gij-4.0
# rm -f $(d_sdk)/$(sdk_path)/bin/javac
# # absolute symlink needed
# ln -sf /usr/bin/ecj-bootstrap-gcj \
# $(d_sdk)/$(sdk_path)/bin/javac
endif
mkdir -p $(d_sdk)/usr/share/doc
rm -rf $(d_sdk)/usr/share/doc/$(p_sdk)
ln -s $(p_jre) $(d_sdk)/usr/share/doc/$(p_sdk)
: # jre manual pages
dh_link -p $(p_jre) \
usr/share/man/man1/gij-$(GCC_VERSION).1.gz \
$(sdk_path)/man/man1/java.1.gz \
usr/share/man/man1/fastjar.1.gz \
$(sdk_path)/man/man1/jar.1.gz \
usr/share/man/man1/gcj-dbtool-$(GCC_VERSION).1.gz \
$(sdk_path)/man/man1/gcj-dbtool.1.gz \
usr/share/man/man1/grmiregistry-$(GCC_VERSION).1.gz \
$(sdk_path)/man/man1/rmiregistry.1.gz
dh_link -p java-gcj-compat \
usr/share/java/libgcj-$(GCC_VERSION).jar \
$(jre_path)/lib/rt.jar \
usr/share/java/libgcj-$(GCC_VERSION).jar \
$(jre_path)/lib/jaas.jar \
usr/share/java/libgcj-$(GCC_VERSION).jar \
$(jre_path)/lib/jsse.jar \
usr/share/java/libgcj-$(GCC_VERSION).jar \
$(jre_path)/lib/jdbc-stdext.jar \
usr/share/java/libgcj-$(GCC_VERSION).jar \
$(jre_path)/lib/jndi.jar \
usr/lib/security/classpath.security \
$(jre_path)/lib/security/java.security \
usr/lib/$(GCJ)/libjawt.so \
$(jre_path)/lib/$(DEB_HOST_GNU_CPU)/libjawt.so \
usr/lib/$(GCJ)/libjvm.so \
$(jre_path)/lib/$(DEB_HOST_GNU_CPU)/client/libjvm.so \
usr/lib/$(GCJ)/libjvm.so \
$(jre_path)/lib/$(DEB_HOST_GNU_CPU)/server/libjvm.so \
ifeq ($(DEB_HOST_GNU_CPU),i386)
ln -sf i386 $(d_jre)/$(jre_path)/lib/i486
endif
ifeq ($(DEB_HOST_GNU_CPU),x86_64)
ln -sf x86_64 $(d_jre)/$(jre_path)/lib/amd64
endif
: # additional jre tools
dh_link -p $(p_jre) \
usr/bin/gij-$(GCC_VERSION) $(sdk_path)/bin/gij \
usr/bin/gcj-dbtool-$(GCC_VERSION) $(sdk_path)/bin/gcj-dbtool
dh_link -p $(p_jre) \
usr/bin/fastjar $(sdk_path)/bin/jar \
usr/bin/fastjar $(jre_path)/bin/jar
: # gjdoc script
rm -f $(d_sdk)/$(sdk_path)/bin/gjdoc
sed -e 's,@SDK_PATH@,$(sdk_path),g' debian/gjdoc.in \
> $(d_sdk)/$(sdk_path)/bin/gjdoc
chmod 755 $(d_sdk)/$(sdk_path)/bin/gjdoc
: # fake jdb script
install -m755 debian/jdb.sh $(d_sdk)/$(sdk_path)/bin/jdb
: # remove python byte-code files
-find debian -name '*.py[co]' | xargs rm -f
rm -f $(d_sdk)/usr/bin/aot-compile-rpm
sed -i '1s,#!.*python[^ ]*\(.*\),#! $(PY_INTERPRETER)\1,' \
$(d_sdk)/usr/bin/aot-compile
: # webplugin
mkdir -p $(d_web)/usr/share/doc
rm -rf $(d_web)/usr/share/doc/$(p_web)
ln -s $(p_jre) $(d_web)/usr/share/doc/$(p_web)
ln -s /usr/lib/$(GCJ)/libgcjwebplugin.so \
$(d_web)/$(jre_path)/lib/libgcjwebplugin.so
ifeq ($(with_ia32),yes)
: # ia32 runtime
rm -rf $(d_ia32)
mkdir -p $(d_ia32)/usr/lib32
cp -a $(d_jre)/usr/lib/jvm $(d_ia32)/usr/lib32/
rm -f $(d_ia32)/$(jre32_path)/lib/x86_64/libjawt.so
mv $(d_ia32)/$(jre32_path)/lib/x86_64 $(d_ia32)/$(jre32_path)/lib/i386
rm -f $(d_ia32)/$(jre32_path)/lib/amd64
ln -sf i386 $(d_ia32)/$(jre32_path)/lib/i486
rm -f $(d_ia32)/$(jre32_path)/bin/keytool
rm -f $(d_ia32)/$(sdk32_path)/bin/keytool
dh_link -p$(p_ia32) \
/usr/bin/ia32-gij-4.1 /$(jre32_path)/bin/gij \
/usr/bin/ia32-gij-4.1 /$(jre32_path)/bin/java \
/usr/bin/ia32-gcj-dbtool-4.1 /$(jre32_path)/bin/gcj-dbtool \
/usr/bin/ia32-grmiregistry-4.1 /$(jre32_path)/bin/rmiregistry
dh_link -p$(p_ia32) \
/usr/bin/ia32-gij-4.1 /$(sdk32_path)/bin/gij \
/usr/bin/ia32-gij-4.1 /$(sdk32_path)/bin/java \
/usr/bin/ia32-gcj-dbtool-4.1 /$(sdk32_path)/bin/gcj-dbtool \
/usr/bin/ia32-grmiregistry-4.1 /$(sdk32_path)/bin/rmiregistry
rm -rf $(d_ia32)/$(sdk32_path)/man
endif
: # provide .jinfo file
( \
echo 'name=$(sdk_dir)'; \
echo 'alias=java-gcj'; \
echo 'priority=$(priority)'; \
echo 'section=main'; \
echo ''; \
for i in $(jre_tools); do \
echo "jre $$i /$(jvmroot)/java-gcj/jre/bin/$$i"; \
done; \
for i in $(jdk_tools); do \
echo "jdk $$i /$(jvmroot)/java-gcj/bin/$$i"; \
done; \
for i in mozilla firefox mozilla-snapshot; do \
echo "plugin $$i-javaplugin.so /usr/lib/$(GCJ)/libgcjwebplugin.so"; \
done; \
) > $(d_jre)/$(jvmroot)/.java-gcj.jinfo
: # debhelper stuff
install -m755 debian/dh_nativejava $(d_sdk)/usr/bin/
mkdir -p $(d_sdk)/usr/share/debhelper/autoscripts
install -m 644 debian/p*-rebuild-gcj-db $(d_sdk)/usr/share/debhelper/autoscripts/
pod2man -c Debhelper debian/dh_nativejava debian/dh_nativejava.1
mkdir -p $(d_sdk)/usr/share/man/man1
install -m644 debian/dh_nativejava.1 $(d_sdk)/usr/share/man/man1/
# Build architecture dependant packages
binary-indep: build
# Build architecture dependant packages
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs -p$(p_jre) ChangeLog
dh_installdocs -p$(p_jre) AUTHORS README
dh_pycentral -p$(p_sdk)
dh_python -p$(p_sdk)
dh_compress $(dh_args)
dh_strip $(dh_args)
dh_fixperms $(dh_args)
dh_installdeb $(dh_args)
dh_gencontrol $(dh_args) \
-- '-Vdev:Depends=$(dev_depends)' '-Vdev:Recommends=$(dev_recommends)' '-Vplugin:Depends=$(plugin_depends)'
dh_md5sums $(dh_args)
dh_builddeb $(dh_args)
binary: binary-arch binary-indep
.PHONY: build clean binary-indep binary-arch binary install configure
|