-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjdk.spec
108 lines (94 loc) · 2.96 KB
/
jdk.spec
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
# http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
# curl -L -b "oraclelicense=a" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz -O
%define __os_install_post %{nil}
%define _unpackaged_files_terminate_build 0
%define _find_requires 0
%define home /usr/java/%{name}%{version}
%define current /usr/java/current
Name: jdk
Summary: Sun JDK
Version: 1.8.0_131
Release: 1.%{dist}
Url: http://java.sun.com
License: Binary Code License Agreement
Vendor: %{vendor}
Packager: %{packager}
Group: Development/Libraries/Java
#Buildroot: java-build
BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
Source0: %{name}-8u131-linux-x64.tar.gz
AutoReq: 0
AutoProv: 0
Provides: jdk = %{version}
Provides: java-openjdk = %{version}
Provides: jre = %{version}
Provides: java = %{version}
%description
Java Development Kit version %{version}
%prep
%setup -n %{name}%{version} -T -b 0
%build
export DONT_STRIP=1
echo "#####################"
echo %{_target_cpu}
echo "########"
echo %{_arch}
%install
export DONT_STRIP=1
rm -rf %{buildroot}
%__mkdir_p %{buildroot}%{home}
%__mkdir_p %{buildroot}%{_bindir}
%__mkdir_p %{buildroot}/etc/profile.d
%__mkdir_p %{buildroot}/etc/ld.so.conf.d
cp -R * %{buildroot}%{home}
cat <<EOF> %{buildroot}/etc/profile.d/jdk.sh
export JAVA_HOME=%{current}
export PATH=\$PATH:%{current}/bin
export CLASSPATH=%{current}/lib
EOF
cat <<EOF> %{buildroot}/etc/ld.so.conf.d/jdk.conf
%{home}/jre/lib/amd64
EOF
#A=`pwd`
#cd %{buildroot}/usr/java
#ln -s %{home} current
ln -sf %{home} $RPM_BUILD_ROOT%{current}
ln -sf %{current}/bin/java $RPM_BUILD_ROOT%{_bindir}/java
ln -sf %{current}/bin/javac $RPM_BUILD_ROOT%{_bindir}/javac
ln -sf %{current}/bin/javadoc $RPM_BUILD_ROOT%{_bindir}/javadoc
ln -sf %{current}/bin/javah $RPM_BUILD_ROOT%{_bindir}/javah
ln -sf %{current}/bin/jar $RPM_BUILD_ROOT%{_bindir}/jar
ln -sf %{current}/bin/javap $RPM_BUILD_ROOT%{_bindir}/javap
ln -sf %{current}/bin/jstack $RPM_BUILD_ROOT%{_bindir}/jstack
ln -sf %{current}/bin/jstat $RPM_BUILD_ROOT%{_bindir}/jstat
ln -sf %{current}/bin/jstatd $RPM_BUILD_ROOT%{_bindir}/jstatd
ln -sf %{current}/bin/jdb $RPM_BUILD_ROOT%{_bindir}/jdb
ln -sf %{current}/bin/jmap $RPM_BUILD_ROOT%{_bindir}/jmap
%post
ldconfig
%postun
rm -f %{home}
ldconfig
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && %__rm -rf $RPM_BUILD_ROOT
[ "%{buildroot}" != "/" ] && %__rm -rf %{buildroot}
[ "%{_builddir}/%{name}-%{version}" != "/" ] && %__rm -rf %{_builddir}/%{name}-%{version}
[ "%{_builddir}/%{name}" != "/" ] && %__rm -rf %{_builddir}/%{name}
%files
%defattr(-,root,root)
%{home}
%{current}
%attr(755, root, root) /etc/profile.d/jdk.sh
#%{_sysconfdir}/ld.so.conf.d/jdk.conf
%{_bindir}/java
%{_bindir}/javac
%{_bindir}/javah
%{_bindir}/javadoc
%{_bindir}/jar
%{_bindir}/javap
%{_bindir}/jstack
%{_bindir}/jstat
%{_bindir}/jstatd
%{_bindir}/jdb
%{_bindir}/jmap
%{_sysconfdir}/ld.so.conf.d/jdk.conf