[opensuse] Simple source rpm as an example
All, I'm messing with the OpenSUSE build service for the first time. I'm confused by the very basics of specfiles. Never built an rpm from scratch so I would like to find a real simple full source rpm to experiment / build on the service. Thanks Greg -- Greg Freemyer Head of EDD Tape Extraction and Processing team Litigation Triage Solutions Specialist http://www.linkedin.com/in/gregfreemyer First 99 Days Litigation White Paper - http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf The Norcross Group The Intersection of Evidence & Technology http://www.norcrossgroup.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Greg Freemyer pecked at the keyboard and wrote:
All,
I'm messing with the OpenSUSE build service for the first time. I'm confused by the very basics of specfiles.
Never built an rpm from scratch so I would like to find a real simple full source rpm to experiment / build on the service.
Thanks Greg
Just download any source rpm, install it and use it to experiment with. They install to /usr/src/packages -- Ken Schneider SuSe since Version 5.2, June 1998 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Greg Freemyer wrote:
All,
I'm messing with the OpenSUSE build service for the first time. I'm confused by the very basics of specfiles.
Never built an rpm from scratch so I would like to find a real simple full source rpm to experiment / build on the service.
https://build.opensuse.org/package/view_file?file=urlenc.spec&package=urlenc&project=home%3Aaljex Very simple spec files only work for very simple packages. For most you will have to figure out more stuff. I manage, barely, by looking at existing spec files of other packages and reading the docs. I found this by typing "how to write spec files" into the search box on opensuse.org http://en.opensuse.org/Packaging -- bkw -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Sat, Apr 4, 2009 at 1:31 PM, Brian K. White
Greg Freemyer wrote:
All,
I'm messing with the OpenSUSE build service for the first time. I'm confused by the very basics of specfiles.
Never built an rpm from scratch so I would like to find a real simple full source rpm to experiment / build on the service.
https://build.opensuse.org/package/view_file?file=urlenc.spec&package=urlenc&project=home%3Aaljex
Very simple spec files only work for very simple packages. For most you will have to figure out more stuff. I manage, barely, by looking at existing spec files of other packages and reading the docs.
I found this by typing "how to write spec files" into the search box on opensuse.org http://en.opensuse.org/Packaging
Brian, Thanks, my project is at least trying to compile now. :) Greg -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Sat, 4 Apr 2009 20:16:25 -0400, you wrote:
Thanks, my project is at least trying to compile now. :)
I'd recommend asking any further questions regarding building packages on opensuse-packaging@opensuse.org as you'll reach a lot more people with experience and knowledge there. Newbies in the area are welcome there so don't hesitate :) Philipp -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Sun, Apr 5, 2009 at 10:14 PM, Philipp Thomas
On Sat, 4 Apr 2009 20:16:25 -0400, you wrote:
Thanks, my project is at least trying to compile now. :)
I'd recommend asking any further questions regarding building packages on opensuse-packaging@opensuse.org as you'll reach a lot more people with experience and knowledge there. Newbies in the area are welcome there so don't hesitate :)
Philipp
Thanks Philipp. I'm asking questions there already. For others, I have found the OpenSuse build project really interesting. It is intriguing to see how it works, but if you don't have a good specfile to work from and you're not familiar with them, then it is a major hassle and the learning curve is steep. Much easier to work with ./configure; make; make install Greg -- Greg Freemyer Head of EDD Tape Extraction and Processing team Litigation Triage Solutions Specialist http://www.linkedin.com/in/gregfreemyer First 99 Days Litigation White Paper - http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf The Norcross Group The Intersection of Evidence & Technology http://www.norcrossgroup.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Mon, 6 Apr 2009 12:06:08 -0400, you wrote:
Much easier to work with ./configure; make; make install
Sorry, but I disagree. This is only easier if you just accept all defaults (wrong as they might be). Otherwise writing a spec file saves you work as it automates the steps. Philipp -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 4/6/2009 at 18:19, Philipp Thomas
wrote: Sorry, but I disagree. This is only easier if you just accept all defaults (wrong as they might be). Otherwise writing a spec file saves you work as it automates the steps.
In order to write a good spec file you first need to understand the ./configure && make && make install steps. If you can't tweak the configure line accordingly, the spec file will not produce a good result (or you rely fully on %configure, which might as well give you wrong results, just that it now splatters everything in prefix+/usr instead of prefix=/usr/local For the case of spec itself: some can be really easy: the preamble might be a bit tricky at the very beginning, but then it breaks down to almost %configure< make< make install Check for example clanbomber2.spec (project games / package clanbomber2). This is not a very different one to what you would do manually: Let's look at it the preamble: BuildRequires: gcc-c++ pkg-config DirectFB-devel FusionSound-devel -> Finding the 'BuildRequires:' you do normally manually by running configure and checking the errors on what is missing. then you do zypper in <what I miss>... all those things go into BuildRequires: Name: clanbomber2 -> Kinda obvious :) is the package name Version: 0.9.1 -> the package version Release: 1.1 -> The release (is always x.y in obs) Url: http://clanbomber.sourceforge.net/ -> Optional, but good practice, a link to the project License: GPL v2 or later -> License Group: Amusements/Games/Action/Arcade - Group, can be tricky to find a good one. Check [0] Summary: Bomberman-like multiplayer game -> Short description of the package (for zypper, yast) Source: %{name}-%{version}.tar.bz2 -> A VERY typical way to refer to the tarball. %{} are variables from above. Patch0: %{name}-%{version}-socklen.patch -> This one even has a patch... BuildRoot: %{_tmppath}/%{name}-%{version}-build -> That you'll just copy from any other spec file (keep it in your template). Where to actually do the builds. %description ClanBomber is a free (GPL) Bomberman-like multiplayer game. -> This entire block (short one.. could be longer...) is used for the long descriptions in Yast or also with rpm -qi %prep %setup -q %patch0 -> translates pretty much to tar xf <by tarball> and apply the patch %build %configure make %{?jobs:-j%jobs} -> the configure; make step (configure with many parameters, admittedly). %install make DESTDIR=$RPM_BUILD_ROOT install -> make install step (DESTDIR is used to redirect to not go to the real prefix... %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %doc AUTHORS COPYING ChangeLog IDEAS README %{_bindir}/clanbomber2 %dir %{_datadir}/clanbomber2 %{_datadir}/clanbomber2/* -> what files get installed by the package. the easiest way to find this list is just to let the package build without the files list and then rpm will give you a list of unpackaged files... %changelog -> All the changes done to your package. Hope this helps you a little bit to get a start. Dominique [0] http://en.opensuse.org/SUSE_Package_Conventions/RPM_Groups -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Mon, Apr 6, 2009 at 12:42 PM, Dominique Leuenberger
On 4/6/2009 at 18:19, Philipp Thomas
wrote: Sorry, but I disagree. This is only easier if you just accept all defaults (wrong as they might be). Otherwise writing a spec file saves you work as it automates the steps. In order to write a good spec file you first need to understand the ./configure && make && make install steps. If you can't tweak the configure line accordingly, the spec file will not produce a good result (or you rely fully on %configure, which might as well give you wrong results, just that it now splatters everything in prefix+/usr instead of prefix=/usr/local
For the case of spec itself: some can be really easy: the preamble might be a bit tricky at the very beginning, but then it breaks down to almost %configure< make< make install
Check for example clanbomber2.spec (project games / package clanbomber2).
This is not a very different one to what you would do manually: Let's look at it the preamble:
BuildRequires: gcc-c++ pkg-config DirectFB-devel FusionSound-devel -> Finding the 'BuildRequires:' you do normally manually by running configure and checking the errors on what is missing. then you do zypper in <what I miss>... all those things go into BuildRequires: Name: clanbomber2 -> Kinda obvious :) is the package name Version: 0.9.1 -> the package version Release: 1.1 -> The release (is always x.y in obs) Url: http://clanbomber.sourceforge.net/ -> Optional, but good practice, a link to the project License: GPL v2 or later -> License Group: Amusements/Games/Action/Arcade - Group, can be tricky to find a good one. Check [0] Summary: Bomberman-like multiplayer game -> Short description of the package (for zypper, yast) Source: %{name}-%{version}.tar.bz2 -> A VERY typical way to refer to the tarball. %{} are variables from above. Patch0: %{name}-%{version}-socklen.patch -> This one even has a patch... BuildRoot: %{_tmppath}/%{name}-%{version}-build -> That you'll just copy from any other spec file (keep it in your template). Where to actually do the builds.
%description
ClanBomber is a free (GPL) Bomberman-like multiplayer game. -> This entire block (short one.. could be longer...) is used for the long descriptions in Yast or also with rpm -qi
%prep %setup -q %patch0 -> translates pretty much to tar xf <by tarball> and apply the patch
%build %configure make %{?jobs:-j%jobs} -> the configure; make step (configure with many parameters, admittedly).
%install make DESTDIR=$RPM_BUILD_ROOT install -> make install step (DESTDIR is used to redirect to not go to the real prefix...
%clean rm -rf $RPM_BUILD_ROOT
%files %defattr(-,root,root) %doc AUTHORS COPYING ChangeLog IDEAS README %{_bindir}/clanbomber2 %dir %{_datadir}/clanbomber2 %{_datadir}/clanbomber2/* -> what files get installed by the package. the easiest way to find this list is just to let the package build without the files list and then rpm will give you a list of unpackaged files...
%changelog -> All the changes done to your package.
Hope this helps you a little bit to get a start. Dominique
[0] http://en.opensuse.org/SUSE_Package_Conventions/RPM_Groups
Thanks, I do appreciate the above, but using the OBS is just not comparable to ./configure; make; make install (assuming it works). I'm installing a relatively small program that did not come with a specfile. I did not have compilers etc. installed on my laptop, so I decided to give the OBS a shot and build a real rpm. The INSTALL file that came with the source could have been followed in short order to get the package installed manually. Doing it via the OBS has taken me hours of trial and error and a few questions on the OBS mailing list. For your typical OpenSUSE user that just wants to compile a package and install it, the OBS is just not ready. For me the biggest issue is the specfile. If the package would have come with a working one, I could have loaded it on the OBS with little effort, but for a newbie to specfiles having to create one is a ton of work. Right now I'm struggling with getting the doc files to install into the packages directory. I'm just about to post to the OBS mailing list about that if you want to follow along FYI: Making Makefiles is also pretty time consuming, but they come with the package the majority of the time, so we just have to type "make" and all is good. Greg -- Greg Freemyer Head of EDD Tape Extraction and Processing team Litigation Triage Solutions Specialist http://www.linkedin.com/in/gregfreemyer First 99 Days Litigation White Paper - http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf The Norcross Group The Intersection of Evidence & Technology http://www.norcrossgroup.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Mon, 6 Apr 2009, Philipp Thomas wrote:-
On Mon, 6 Apr 2009 12:06:08 -0400, you wrote:
Much easier to work with ./configure; make; make install
Sorry, but I disagree. This is only easier if you just accept all defaults (wrong as they might be). Otherwise writing a spec file saves you work as it automates the steps.
If you use the script "build" then you can get the same results as if you used the build service, but also a lot faster. This makes fixing a broken spec file a lot faster and easier. I have a few templates spec[0] files ready to modify to suit whatever package type I'm building[1] which I just fill in the required bits to make the package build. My normal method of working is to use the build script to start by creating a clean build environment[2], and tweak the spec file between each build run. It means that I can rapidly add build dependencies that the configure script sometimes misses. Also, by starting with an empty %files section, I get around the problem of not knowing what files are going to be installed as the build I get told what files were installed but not packages. This I find makes it much easier to know just what needs to be added. As for what I use as the build system, I use a 64bit 11.0 system but build using an 11.1 build environment. This gets me the package checks that would be performed when building on the build service, again letting me fix problems quickly. Once the test build is successful, I redo the test builds for both the 32bit and 64bit versions of 10.3 to 11.1, each with it's one separate build-root[3]. Once a build is successful on all those, I upload the spec file and source packages to the build service where it builds them for the versions I don't have[4] as well as those I do. [0] They wouldn't be very easy for a novice to read, at least not at first, since I have added quite a few macros to them to make it a lot easier for me to build cross-distro packages. [1] KDE3.5, Gnome, Perl, CLI. I don't have Python or KDE4 in my templates, as yet, since I've not yet built any packages requiring them. [2] It only starts "clean". While fixing the spec file, I don't reinitialise the build environment. Once the package has built successfully, then I rebuild with a completely fresh environment. [3] I also have an old 10.3 PPC based system which I sometimes use to do builds as well. This one has had lzma installed so it can create an 11.0 and 11.1 build system, but I don't use it too often as it's very slow to build some packages. [4] Fedora, Mandriva, SLED10, Factory. I've not yet tried building a Debian/Ubuntu package but it is on my to-do list. Regards, David Bolt -- Team Acorn: http://www.distributed.net/ OGR-NG @ ~100Mnodes RC5-72 @ ~1Mkeys/s openSUSE 10.3 32b | openSUSE 11.0 32b | | openSUSE 10.3 64b | openSUSE 11.0 64b | openSUSE 11.1 64b | openSUSE 10.3 PPC | RISC OS 3.6 | RISC OS 3.11 | TOS 4.02 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (6)
-
Brian K. White
-
David Bolt
-
Dominique Leuenberger
-
Greg Freemyer
-
Ken Schneider - openSUSE
-
Philipp Thomas