You are not logged in.

#1 2010-12-21 02:03:55

chrisbuchholz
Member
From: Denmark
Registered: 2010-12-21
Posts: 25
Website

[solved] Packaging software while keeping a sane file structure

Hi guys,

So I have created a piece of software which I wanna package and post to AUR (should note, that I have never packaged anything for any distro before), and I have also got it packaged and installed on my own machine via pacman successfully, but now I am wondering how on earth am I gonna structure the folders and files?

Normally, I have this structure:

   build/        src/       makefile

As a minimum, and in the case of this piece of software, the makefile does nothing more than compile a .cpp file from src/ to build/.
To make the Arch package, I also had to create a .rc file, to use the program properly as a daemon and the PKGBUILD file - these two files, though, are specific to Arch. If I wanna package the program for say debian, I would need another set of files to do this. Now, I can't just put the .rc file and PKGBUILD file in to the programs root folder, since that would "be a mess", but where do I put it? I need to have it in the programs top-folder -at-least- to be able to keep track of it, and my initial thought was to go with a structure like distro/arch/ for Arch Linux specific files, and then the PKGBUILD file would just run the makefile in the programs root folder and copy the compiled file from build/ to distro/arch/ before it did anything else, but I discovered that I couldnt get PKGBUILD to work that way, and people on #archlinux on Freenode also said it was not a smart idea.

So where do I put the distro specific files? If I knew I only had to provide this program for Arch, it would be easy to just structure it only for Makepkg, but I dont like to imprison like that, and I could also imagine providing packages for other mayor distros like debian, so how do I achieve this while keeping a sane file structure?

Regards,
Chris Buchholz

Last edited by chrisbuchholz (2010-12-27 20:14:24)

Offline

#2 2010-12-21 09:58:45

shpelda
Member
Registered: 2008-08-07
Posts: 59

Re: [solved] Packaging software while keeping a sane file structure

Just don't keep distro specific files in your source package.
This are files that should be kept in that distro-specific package. Nowhere else.

Offline

#3 2010-12-21 10:36:15

chrisbuchholz
Member
From: Denmark
Registered: 2010-12-21
Posts: 25
Website

Re: [solved] Packaging software while keeping a sane file structure

shpelda wrote:

Just don't keep distro specific files in your source package.
This are files that should be kept in that distro-specific package. Nowhere else.

I hearing you say, that one should have a structure like:

    programname/    programname-arch/    programname-debian/

and so forth, but aint that gonna be a big mess of scattered structure?
I dont suppose you could sketch, just simply, the structure that you for example uses, which I guess is more sane than that?

I could also think of a structure that looks like:

    programname/    programname/source/    programname/distro/arch/    programname/distro/debian/

where source is the actual source of the program, and programname/distro/ contains folders that implement the source in a distro-specific way. That way, the source and the distro-specifics wont get mixed, but will at the same time reside inside the same parent-folder.

Offline

#4 2010-12-21 11:44:04

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: [solved] Packaging software while keeping a sane file structure

Have you looked at the AUR wiki page or at other packages in the AUR?

If I understand you correctly, the PKGBUILD and rc file need not be in the source of your program. It should be placed in the Arch Linux package:

$ ls
 programname.install programname.rc programsource.tar.gz PKGBUILD

Last edited by dyscoria (2010-12-21 11:45:23)


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#5 2010-12-21 11:50:07

chrisbuchholz
Member
From: Denmark
Registered: 2010-12-21
Posts: 25
Website

Re: [solved] Packaging software while keeping a sane file structure

dyscoria wrote:

Have you looked at the AUR wiki page or at other packages in the AUR?

If I understand you correctly, the PKGBUILD and rc file need not be in the source of your program. It should be placed in the Arch Linux package:

$ ls
 programname.install programname.rc programsource.tar.gz PKGBUILD

Yeah that is right, but what I am trying to figure out, is not how to structure the Arch package, but how to structure the actual project with source files, distro-packages and so.

Offline

#6 2010-12-21 13:44:08

dyscoria
Member
Registered: 2008-01-10
Posts: 1,007

Re: [solved] Packaging software while keeping a sane file structure

Well in general, these kind of files are not included in your source, but only in distro-packages.

Is there a specific reason why you wish to include PKGBUILD and rc file (and other distro specific files) inside your source? Creation and management of these files are usually left down to the package maintainer, either in AUR or in an official repository. I've never seen such files included in the source of any program.


flack 2.0.6: menu-driven BASH script to easily tag FLAC files (AUR)
knock-once 1.2: BASH script to easily create/send one-time sequences for knockd (forum/AUR)

Offline

#7 2010-12-21 17:44:07

chrisbuchholz
Member
From: Denmark
Registered: 2010-12-21
Posts: 25
Website

Re: [solved] Packaging software while keeping a sane file structure

dyscoria wrote:

Well in general, these kind of files are not included in your source, but only in distro-packages.

Is there a specific reason why you wish to include PKGBUILD and rc file (and other distro specific files) inside your source? Creation and management of these files are usually left down to the package maintainer, either in AUR or in an official repository. I've never seen such files included in the source of any program.

The reason why I want this, is because is this case, I'm both the author and the package maintainer of the software, and I simply need to know of a great structure of how I can be organizing all the files of the project - both the source and the package files.

Offline

#8 2010-12-21 18:21:28

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: [solved] Packaging software while keeping a sane file structure

I think I'm in a similar situation. I recently wrote an application and then created an Arch Linux package for it.

It's tempting to think of both software development and package management as being the same project, but I would invite you to work on them separately think of them as separate projects.

So... I recommend your directory structure look like this:

~/Projects/myapp/build/
~/Projects/myapp/src/
~/Projects/myapp/Makefile

~/Projects/myapp-arch/PKGBUILD

~/Projects/myapp-debian/

In "~/Projects/myapp/", do a "make clean" command, zip it up it as "myapp-1.0.tar.gz", and post it on some website such as SourceForge or GitHub or whatever as the "source code version".

Then, create your PKGBUILD file which would download the source code version of your application from the website I just mentioned above. Create packages for other package managers, and you can post them on the website as well.

How does that sound? smile

Offline

#9 2010-12-21 18:26:01

chrisbuchholz
Member
From: Denmark
Registered: 2010-12-21
Posts: 25
Website

Re: [solved] Packaging software while keeping a sane file structure

drcouzelis wrote:

I think I'm in a similar situation. I recently wrote an application and then created an Arch Linux package for it.

It's tempting to think of both software development and package management as being the same project, but I would invite you to work on them separately think of them as separate projects.

So... I recommend your directory structure look like this:

~/Projects/myapp/build/
~/Projects/myapp/src/
~/Projects/myapp/Makefile

~/Projects/myapp-arch/PKGBUILD

~/Projects/myapp-debian/

In "~/Projects/myapp/", do a "make clean" command, zip it up it as "myapp-1.0.tar.gz", and post it on some website such as SourceForge or GitHub or whatever as the "source code version".

Then, create your PKGBUILD file which would download the source code version of your application from the website I just mentioned above. Create packages for other package managers, and you can post them on the website as well.

How does that sound? smile

That actually sounds brilliant! I will try to work on a structure like that, thanks.

Offline

Board footer

Powered by FluxBB