Simple spec file for creating RPM package

fedora, rpm-spec, rpmbuild

Solution

Create ~/.rpmmacros to set up RPM build environment.

$ mkdir -p ~/rpmbuild/{BUILD,RPMS/{i{3,4,5,6}86,x86_64,noarch},SOURCES,SPECS,SRPMS}
$ echo "%_topdir $HOME/rpmbuild" > ~/.rpmmacros

And put run.jar/run.sh and spec file into ~/rpmbuild/SOURCES and ~/rpmbuild/SPECS/ respectively.

EDIT: In a spec file:

(skip)

Source0: run.jar
Source1: run.sh

(skip)

%install

%{__mkdir_p} ${RPM_BUILD_ROOT}/path/to/my-package

%{__install} -m0644 %{SOURCE0} ${RPM_BUILD_ROOT}/path/to/my-package
%{__install} -m0644 %{SOURCE1} ${RPM_BUILD_ROOT}/path/to/my-package

(skip)

%files
/path/to/my-package/*

Problem

I have a binary Java `run.jar` file, a bash script `run.sh` which executes `run.jar` via `java -jar`. - In my environment (`~/rpmbuild/`), where do I have to put those two files? Where do I have to put the source file? (I guess I should compress the source as `.tar.gz`) How can I write the spec file to: - Make directory `~/bin/my-package`; - Copy `run.jar` and `run.sh` to above directory; That's all I want. Would you please help me a little? Thanks for your time. P.S: I went through this how-to. Unfortunately I'm newbie in this, I couldn't find the solution.

Original source