开发者

Packaging Linux software while keeping a sane file structure

开发者 https://www.devze.com 2023-01-31 09:09 出处:网络
So I have created a piece of software which I wanna package and post to Arch Linux User Repositories, AUR, -should note, that I have never packaged anything for any distro before - and I have also got

So I have created a piece of software which I wanna package and post to Arch Linux User Repositories, 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 Arch's package manager Pacman successfully, but now I am wondering how on earth am I gonna structure the folders and files?

Normally when I wrote software, I use 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, which is the file that tells the makepkg program how to build the installer-package - 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 too, but these files only work for debian. Now, I can't just put the .rc file and the PKGBUILD file in to the programs root folder, since that would "be a mess" especially if I also had files to build a package for debian, but where开发者_开发技巧 do I put the distro-specific files? I need to have it in the programs root 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 the softwarelike 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


Very often you find in tarballs a directory called 'debian' which has the debian specific files in it. I would go the same route and create a directory 'archlinux' and put the files there.

Then I would go on and put a file README in the archlinux directory that explains how to use the PKGBUILD properly.

One solution could be to write a rule into your Makefile 'package-arch' that copies the PKGBUILD into the root directory, runs makepkg, then deletes the redundant PKGBUILD.

It's hackish, so I would also write a bug report for the Arch people to fix this limitation. However, did you try makepkg -p archlinux/PKGBUILD?

0

精彩评论

暂无评论...
验证码 换一张
取 消