Relative Path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I want to create an rpm for a java program that is not from me because one of my program depend on it.

The problem I have is that I want to create an executable that call java with the right classpath. Bascially I want : java -classpath %{_javadir}/%{jarfile} -DLibrary-Path=\${TLAPATH} tlc.TLC \$@

The problem is that I want my package to be relocatable. I create the executable in the %install section with a cat command. The best way might be to find the relative path from %{_bindir}/tlc to %{_javadir}/%{jarfile} but how can I do this ?

By the way, if you find really stupid things in my spec, tell me ! This is my first one ;-)

--
Thanks,
Loïc
%define name    tla
%define version 0.0
%define release 1

%define jarfile %{name}-%{version}.jar

Summary: Tools for TLA+ specifications
Name: %{name}
Version: %{version}
Release: %{release}
License: MSR-SSLA
Group: Applications/Sciences
URL: http://research.microsoft.com/users/lamport/tla/tools.html
Source0: http://research.microsoft.com/research/downloads/download.aspx?FUID={BC81B5F4-5801-4AD9-AECD-426912C2BCDE}/tla.zip
Patch0: tla.patch.bz2
nosource: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}

%description
TLA+ is a language for writing TLA specifications.
The tools are a parser, a syntax checker, a model-checker and a typesetting
program for TLA+.
tlc is a model checker and simulator for a subclass of
"executable" TLA+ specifications.
tlasany is a parser and syntax checker for TLA+ specifications.
tlatex is a program for typesetting TLA+ specifications.

%prep
%setup -q -n tla
%patch0 -p1

%build
# compile everything
find . -type f -name "*.java" | xargs javac

# change rights
chmod 0644 README License.txt
find examples -type d -exec chmod 0755 {} \;
find examples -type f -exec chmod 0644 {} \;
chmod -R 0644 tlasany/StandardModules/*.tla

# jar 
cat > MANIFEST.MF <<EOD
Manifest-Version: %{version}
Specification-Title: %{name}
Specification-Version: %{version}
Specification-Vendor: Microsoft
Implementation-Title: %{name}
Implementation-Version: %{version}
Implementation-Vendor: Microsoft
EOD
jar -cvfm %{jarfile} MANIFEST.MF util/*.class tlatex/*.class tlatex/*.txt tlatex/README tlatex/tlatex.sty tlatex/words.all tlc/*.class tlc/{pprint,tool,tool/liveness,util,value}/*.class tlasany/*.class tlasany/{configuration,drivers,error,explorer,modanalyzer,parser,semantic,st,utilities}/*.class README License.txt

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_javadir}
cp %{jarfile} $RPM_BUILD_ROOT%{_javadir}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}
#cp -R examples $RPM_BUILD_ROOT%{_datadir}/%{name}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/StandardModules/
cp -f tlasany/StandardModules/*.tla $RPM_BUILD_ROOT%{_datadir}/%{name}/StandardModules/
mkdir -p $RPM_BUILD_ROOT%{_bindir}
cat > $RPM_BUILD_ROOT%{_bindir}/tlc <<EOD
#!/bin/sh
if (! \$?TLAPATH) then
    export TLAPATH= %{_datadir}/%{name}/StandardModules
endif
java -classpath  %{_javadir}/%{jarfile} -DLibrary-Path=\${TLAPATH} tlc.TLC \$@
EOD
chmod a+x $RPM_BUILD_ROOT%{_bindir}/tlc

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc README License.txt
%{_javadir}/%{jarfile}
%{_bindir}/tlc
%{_datadir}/%{name}
#%{_datadir}/%{name}/StandardModules
#%{_datadir}/%{name}/StandardModules/Bags.tla
#%{_datadir}/%{name}/StandardModules/FiniteSets.tla 
#%{_datadir}/%{name}/StandardModules/Integers.tla
#%{_datadir}/%{name}/StandardModules/Naturals.tla
#%{_datadir}/%{name}/StandardModules/Reals.tla
#%{_datadir}/%{name}/StandardModules/RealTime.tla
#%{_datadir}/%{name}/StandardModules/Sequences.tla
#%{_datadir}/%{name}/StandardModules/TLC.tla

%changelog
* Wed Sep 21 2005 Loic Fejoz <loic.fejoz@xxxxxxxx> 
- Initial build.


_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux