SPECS: java-sun.spec - modify RPATH so that java can be used witho...

glen glen at pld-linux.org
Wed Feb 28 01:53:49 CET 2007


Author: glen                         Date: Wed Feb 28 00:53:49 2007 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- modify RPATH so that java can be used without /proc mounted (builders)

---- Files affected:
SPECS:
   java-sun.spec (1.174 -> 1.175) 

---- Diffs:

================================================================
Index: SPECS/java-sun.spec
diff -u SPECS/java-sun.spec:1.174 SPECS/java-sun.spec:1.175
--- SPECS/java-sun.spec:1.174	Tue Feb 13 09:06:36 2007
+++ SPECS/java-sun.spec	Wed Feb 28 01:53:44 2007
@@ -374,6 +374,47 @@
 ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_jvmjardir}/jre
 ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_jvmjardir}/jsse
 
+# modify RPATH so that javac and friends are able to work when /proc is not mounted
+# and we append to RPATH not to break previous behaviour.
+# for example:
+# javac: RPATH=$ORIGIN/../lib/i386/jli:$ORIGIN/../jre/lib/i386/jli
+# javac: new RPATH: /usr/lib/jvm/java-sun-1.6.0/jre/lib/i386/jli
+
+fixrpath() {
+	execlist=$(find $RPM_BUILD_ROOT%{javadir} -type f -perm +1 | xargs file | awk -F: '/ELF.*executable/{print $1}')
+	for f in $execlist; do
+		rpath=$(chrpath -l $f | awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }')
+		[ "$rpath" ] || continue
+
+		# file
+		file=${f#$RPM_BUILD_ROOT}
+		origin=${file%/*}
+
+		new=
+		# first include existing rpath
+		for a in $rpath; do
+			new=${new}${new:+:}$a
+		done
+		for a in $rpath; do
+			t=$(echo $a | sed -e "s,\$ORIGIN,$origin,g")
+			# get rid of ../../
+			t=$(t=$RPM_BUILD_ROOT${t%/*}; mkdir -p $t; cd $t; pwd)
+			t=${t#$RPM_BUILD_ROOT}
+
+			if [[ "$new" != *$t* ]]; then
+				# append it now
+				new=${new}:$t
+			fi
+		done
+		echo "update RPATH $file:"
+		echo "OLD: $rpath"
+		echo "NEW: $new"
+		chrpath -r ${new} $f
+	done
+}
+
+fixrpath
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -775,6 +816,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.175  2007/02/28 00:53:44  glen
+- modify RPATH so that java can be used without /proc mounted (builders)
+
 Revision 1.174  2007/02/13 08:06:36  glen
 - tabs in preamble
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/java-sun.spec?r1=1.174&r2=1.175&f=u



More information about the pld-cvs-commit mailing list