Thursday, September 30, 2010

Success! Creating my own spec file for NLED

Success! 


I finally got around to finishing my own spec file for NLED. I can tell you this - I learned quite a lot going through each one of the errors and trying to research and fix it. I'll admit it was quite frustrating at first. Getting it to finally work was good, but the best part was gaining a MUCH better understanding of how the .spec file works.

The Fedora How to pointed me in all the right directions, and of course, can't forget man's new best friend - Google. I just needed to spend some time going through the sections and understand what each is supposed to do.

I will attach my RPM file here as well as the SPEC file for those of you who are interested. Please see below:

Spec file: http://asdesigned.ca/nled.spec
Please Right-click and use "Save as" to download the nled.spec file or just simply click on it to view it in the browser

RPM File: http://asdesigned.ca/nled-2.52-8.fc12.i686.rpm 


A Few Notes

  • NLED does not require any ./configure or make install commands, instead it is simply compiled using the make command, where it will create the nled binary that can be placed into /usr/bin/ and executed anywhere on the command line.
  • Therefore, you will have to remove the ./configure option from the %build section of the spec file and also remove the make install option from the %install section
  • I took a look at the original NLED Makefile and at the top it showed that the make options were CCOPTIONS=–O –c and LDOPTIONS=–lcurse

# AIX: CCOPTIONS=-qnoro -O -c
# some Linuxes: CCOPTIONS=-O -c -I /usr/include/ncurses
# other Linuxes (try this first):
CCOPTIONS=-O -c

# AIX: LDOPTIONS=-lcurses
# some Linuxes: LDOPTIONS=-lncurses
# other Linuxes:
LDOPTIONS=-lcurses
So I added to the %build section:   
make %{?_smp_mflags} CCOPTIONS="-O -c" LDOPTIONS="-lcurses"
  • Next, the installation needs to be done "by hand" and the files need to be copied to the correct locations. Therefore, we need to create the directories (using mkdir -p) and then copy the files from inside the build directory to the buildroot directory (using cp -p). So following the Fedora How To resource, I added:
%install 
rm -rf %{buildroot} 
mkdir -p %{buildroot}%{_bindir}/ 
cp -p nled %{buildroot}%{_bindir}/
  •  After doing that, I got an error when running rpmbuild:
error: Installed (but unpackaged) file(s) found:
       /usr/bin/nled
This just means that I did not count those files under the %files section, as the %files section identifies what files and directories were added by the package - and thus, which files and directories are owned by the package.

To fix it, I just needed to add %{_bindir}/* under the %files section, and the rest is history.

No comments:

Post a Comment