File: rules

package info (click to toggle)
jruby 9.3.9.0%2Bds-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 80,856 kB
  • sloc: ruby: 517,823; java: 260,094; xml: 31,930; ansic: 5,777; yacc: 4,973; sh: 1,163; makefile: 105; jsp: 48; tcl: 40; exp: 11
file content (128 lines) | stat: -rwxr-xr-x 5,222 bytes parent folder | download
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
#!/usr/bin/make -f

include /usr/share/dpkg/default.mk
include /usr/share/javahelper/java-vars.mk

export JAVA_HOME=/usr/lib/jvm/default-java
export RUBYGEMS=lib/target/rubygems

%:
	dh $@ --buildsystem=maven

execute_after_dh_auto_clean:
	@rm -rf ./lib/ruby/gems ./lib/jruby.jar
	@rm -f ./bin/bundle ./bin/bundler ./bin/irb ./bin/rdoc ./bin/ri
	-cd ./spec/ffi/fixtures/ && rm -f *.o *.so
	# we should perhaps make some attempt to cleanup lib/ruby/stdlib
	# but it becomes so intertwined with the gem-installed libs that
	# the attempts below is incomplete at best
	# (upstream seems to be moving towards gem-only stdlib)
	-cd ./lib/ruby/stdlib && (												\
		rm -f ant.rb cmath.rb digest.jar ipaddr.rb mutex_m.rb ostruct.rb	\
			digest.jar prime.rb shell.rb ;									\
		rm -rf bundler* csv* did_you_mean* e2mmap* ffi* fowardable*	irb*	\
			io/console* jar* jopenssl* json* logger* openssl* matrix*		\
			psych* rdoc* readline* rexml* rss* scanf* shell sync* thwait*	\
			tracer* webrick* ;												\
	)

execute_before_dh_auto_configure:
	# install dependencies as jruby gems
	mkdir -p $(RUBYGEMS)
	for gem in rubygems-default/*.gem; do	\
	  gem install --local					\
		--ignore-dependencies				\
		--no-document						\
		--wrappers							\
		--install-dir $(RUBYGEMS)			\
		$${gem} ;							\
	done
	# rubygems_plugin not wanted in jruby (see lib/pom.rb)
	rm -f lib/ruby/stdlib/rubygems_plugin.rb
	# create empty openssl.rb (see lib/pom.rb)
	touch lib/ruby/stdlib/openssl.rb
	# remove bundled jars
	# they are replaced by symlinks in $JRUBY_HOME
	rm -rf $(RUBYGEMS)/gems/jruby-readline-*/lib/jline
	sed -i -e "/^load \"jline\/jline.*/d"	\
		$(RUBYGEMS)/gems/jruby-readline-*/lib/readline.rb
	rm -rf $(RUBYGEMS)/gems/jruby-openssl-*/lib/org/bouncycastle
	sed -i -e "/^require 'jar-dependencies'/d" -e "/^require_jar.*/d" \
		$(RUBYGEMS)/gems/psych-*/lib/psych_jars.rb
	# copy ruby libs to stdlib directory (see lib/pom.rb)
	cp -a $(RUBYGEMS)/gems/*/lib/* lib/ruby/stdlib
	# default gem specifications
	mkdir -p lib/ruby/gems/shared/specifications/default
	cp -a $(RUBYGEMS)/specifications/* lib/ruby/gems/shared/specifications/default
	# default gem binaries
	mkdir -p lib/ruby/gems/shared/gems
	cd $(RUBYGEMS)/gems && (															\
		find . -maxdepth 2 -type d -and \( -name bin -or -name exe \) -printf "%P\n"	\
			| while read dir; do														\
				mkdir -p $(CURDIR)/lib/ruby/gems/shared/gems/$$dir ;					\
				cp $$dir/* $(CURDIR)/lib/ruby/gems/shared/gems/$$dir ;					\
				cp $$dir/* $(CURDIR)/bin ;												\
		done )

execute_after_dh_auto_configure:
	# install maven-repo symlinks to fix jruby-stdlib dependency resolution
	# of org.jruby:jruby-core:jar:debian
	mkdir --parents debian/maven-repo/org/jruby/jruby-core/debian
	ln -s ../../../../../../shaded/target/jruby-core-$(DEB_VERSION_UPSTREAM:+ds=).jar \
		debian/maven-repo/org/jruby/jruby-core/debian/jruby-core-debian.jar
	ln -s ../../../../../../shaded/pom.xml \
		debian/maven-repo/org/jruby/jruby-core/debian/jruby-core-debian.pom

override_dh_auto_build:
	dh_auto_build -- -Djruby.revision=$(DEB_VERSION) -Pmain,complete,dist

override_dh_auto_test:
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	# java tests
	# to debug a single test, add -Dtest=org/jruby/test/<TestFileName>.java
	dh_auto_test -- -Djruby.revision=$(DEB_VERSION) -Ptest -pl org.jruby:jruby-base
endif

DIST_TARBALL=./maven/jruby-dist/target/jruby-dist-$(DEB_VERSION_UPSTREAM:+ds=)-bin.tar.gz
DIST_TARGET_DIR=./target/package/
override_dh_prep:
	dh_prep
	mkdir -p $(DIST_TARGET_DIR)
	# unpack dist tarball in package target directory
	tar zxf $(DIST_TARBALL) -C $(DIST_TARGET_DIR) --strip-components=1
	# prepare package bin/ and jni/
	cd $(DIST_TARGET_DIR) && (         						  					\
		rm -f ./bin/jruby.sh ./bin/*.bat										\
		&& mv ./bin/jruby.bash ./bin/jruby										\
		&& sed -i '1s|^#!/usr/bin/env\sbash|#!/bin/bash|' ./bin/jruby			\
		&& sed -i '1s|^#!/usr/bin/env\sruby|#!/usr/bin/jruby|' ./bin/*			\
			./lib/ruby/gems/shared/gems/*/bin/*									\
			./lib/ruby/gems/shared/gems/*/exe/*									\
		&& chmod 0755 ./bin/*													\
		&& echo "-Djruby.openssl.load.jars=false" >> ./bin/.jruby.module_opts	\
		&& mkdir -p ./lib/jni/ )

execute_after_dh_install:
	# install additional maven poms and jars
	mh_installpom -pjruby ./maven/pom.xml
	mh_installpom -pjruby ./maven/jruby/pom.xml
	mh_installjar -pjruby ./maven/jruby/pom.xml \
		./maven/jruby/target/jruby-$(DEB_VERSION_UPSTREAM:+ds=).jar
	mh_installpom -pjruby ./maven/jruby-complete/pom.xml
	mh_installjar -pjruby ./maven/jruby-complete/pom.xml \
		./maven/jruby-complete/target/jruby-complete-$(DEB_VERSION_UPSTREAM:+ds=).jar
	# remove bundled font files from stdlib (rdoc templates)
	find debian/jruby/usr/share/jruby/lib/ruby/stdlib -name \*.ttf -type f -print -delete
	# apply Class-Path attribute to main jar
	jh_classpath

execute_after_dh_installexamples:
	# remove vcs control file
	rm debian/jruby/usr/share/doc/jruby/examples/jnlp/.gitignore

get-orig-source:
	# jruby sources
	uscan --watchfile=$(CURDIR)/debian/watch --verbose --force
	# ruby libraries that upstream fetches from rubygems.org
	# specific versions needed for jruby
	$(CURDIR)/debian/gem-download.sh