You are not logged in.

#1 2015-12-22 08:46:56

zabrielza
Member
Registered: 2015-03-02
Posts: 125

[Solved]How to create a PKGBUILD for any application

Hello,

It's time for me to learn how to create a package from a tar.gz file. For example, I want to install bricscad with pacman instead of using sh scripts to start the program. So, I downloaded a tar.gz provided by the company and after that i started reading arch wiki pages about creating PKGBUILD etc. I copied a sample PKGBUILD as the wiki proposes but i have many fields empty. For example, how can i determine the depends of bricscad? I am not looking for a solution about this specific program but for some knowledge in order to install with pacman any program I want, just like configure, make, make install i was used to when using ubuntu, debian etc.

Now I have created a directory abs/bricscad, and have already copied PKGBUILD.proto from /usr/share/pacman and have started filling out all the information about the package.

Thanks

Last edited by zabrielza (2015-12-22 17:47:25)

Offline

#2 2015-12-22 09:03:42

bstaletic
Member
Registered: 2014-02-02
Posts: 658

Re: [Solved]How to create a PKGBUILD for any application

configure/make/make install is not a good practise on any distro, as package manager has no idea about the files a package installs. On the other hand it is applicable to any linux distro and possibly any *nix OS. This is how LFS is done by default.

Dependencies should be listed on projects homepage. Failing that search zugaina (collection of gentoo overlays), failing that take a lok at xpbs-src github repo (void linux packages similar to PKGBUILDS).

Offline

#3 2015-12-22 09:13:02

zabrielza
Member
Registered: 2015-03-02
Posts: 125

Re: [Solved]How to create a PKGBUILD for any application

configure/make/make install is not a good practise on any distro, as package manager has no idea about the files a package installs.

Yes, as I remember i was used to install package with checkinstall which creates a .deb file. I suppose I am trying to find out how the arch way is working.

Dependencies should be listed on projects homepage. Failing that search zugaina (collection of gentoo overlays), failing that take a lok at xpbs-src github repo (void linux packages similar to PKGBUILDS).

About project's homepage, Bricscad is not an open source and nowhere in the compressed file they provide dependencies are listed. I fount this link and as I can see it has no dependencies. I will search for zugaina and xpbs-src as you mentioned.

Also, this is Bricscad-legacy  PKGBUILD.

source=("bricscadv13.2.17.tar.gz::https://copy.com/OiQ2c4w7MJgQREeh/bricscadv13.2.17.tar.gz?download=1"
	"bricscad_simple_logo.png::https://copy.com/gtABrL8xpsb8yl3H/bricscad_simple_logo.png?download=1"
	"bricscad.desktop::https://copy.com/P8g06DHcgUhnu86o/bricscad.desktop?download=1"
	"bricscad13::https://copy.com/I0TrmpazRUFyXY7G/bricscad13?download=1")

Do I have to upload files in order to download them or can i have them locally on my computer?

Last edited by zabrielza (2015-12-22 09:16:46)

Offline

#4 2015-12-22 09:14:45

TheChickenMan
Member
From: United States
Registered: 2015-07-25
Posts: 354

Re: [Solved]How to create a PKGBUILD for any application

There's plenty of information in the wiki but starting trying to make a pkgbuild for some random proprietary software is probably not a good first step. Build a couple of small things which are already in the repositories and already have pkgbuilds which you can look at.


If quantum mechanics hasn't profoundly shocked you, you haven't understood it yet.
Niels Bohr

Offline

#5 2015-12-22 12:51:48

zabrielza
Member
Registered: 2015-03-02
Posts: 125

Re: [Solved]How to create a PKGBUILD for any application

Finally, I managed to create the PKGBUILD. So this is it,

# Maintainer: Zabriel Zacob <zabraz00@gmail.com>
pkgname=bricscad
pkgver=15.3.09
pkgrel=1
epoch=
pkgdesc="Professional CAD/BIM software for 2D and 3D"
arch=('x86_64')
url=""
license=('commercial')
groups=()
depends=()
makedepends=()
checkdepends=()
optdepends=()
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
source=("BricsCAD-V15.3.09-1-en_US-amd64.tar.gz::https://copy.com/jxdah4vWEwmrqQLm/BricsCAD-V15.3.09-1-en_US-amd64.tar.gz?download=1"
	"bricscad_simple_logo.png::https://copy.com/L2a8NNAFBX2OwdW6/bricscad_simple_logo.png?download=1"
	"bricscad.desktop::https://copy.com/0KPzao64UaaFf1SH/bricscad.desktop?download=1"
	"bricscad15::https://copy.com/SNNhYdxd3K7AwVoz/bricscad15?download=1")

md5sums=(
	'4d0af27a6bfc52fb189e96147258e755'
	'c24313275d36fa6db16d92d530862739'
	'168270e14bac79f6ad58d36faed6e8b8'
	'e1d2a572e47f0c4b567af6a4e3d6c231'
) 

noextract=("BricsCAD-V15.3.09-1-en_US-amd64.tar.gz")
validpgpkeys=()

#prepare() {
#	cd "$pkgname-$pkgver"
#	patch -p1 -i "$srcdir/$pkgname-$pkgver.patch"
#}

build() {
	#cd "$pkgname-$pkgver"
	#./configure --prefix=/usr
	#make
	# Extract the tarball
    cd ${srcdir}
    mkdir -p bricscad
    tar xzf BricsCAD-V15.3.09-1-en_US-amd64.tar.gz -C bricscad/
}

#check() {
#	cd "$pkgname-$pkgver"
#	make -k check
#}

package() {
	#cd "$pkgname-$pkgver"
	#make DESTDIR="$pkgdir/" install
	# Create directories
    install -dm755 ${pkgdir}/{opt/${pkgname},usr/{bin,share/applications}}
    # Copy the files
    cd ${srcdir}
    cp -R bricscad ${pkgdir}/opt/${pkgname}/
    install -Dm644 bricscad_simple_logo.png ${pkgdir}/opt/${pkgname}/bricscad/
    install -Dm644 bricscad.desktop         ${pkgdir}/usr/share/applications/
    install -Dm755 bricscad15               ${pkgdir}/usr/bin/
    # Create a link in /usr/bin
    #ln -s /opt/${pkgname}/bricscad/bricscad.sh ${pkgdir}/usr/bin/bricscad13
}

I have installed the generated package with pacman. I am not sure if this is the right place to ask for help but i get this error,

/opt/bricscad/bricscad/bricscad: error while loading shared libraries: libpth.so.20: cannot open shared object file: No such file or directory

Is this related to the PKGBUILD or something about this lib file? I could not locate it in my system.

Offline

#6 2015-12-22 13:03:35

bstaletic
Member
Registered: 2014-02-02
Posts: 658

Re: [Solved]How to create a PKGBUILD for any application

It means libpth.so.20 is not found on your system and, since bricscad is linked against it, execution fails. Find which package provides that file and put the name of the package in depends array of your PKGBUILD. For testing just install the package providing libpth.

The package is probably called libpth, but you can find out with

pkgfile libpth.so.20

Offline

#7 2015-12-22 17:46:45

zabrielza
Member
Registered: 2015-03-02
Posts: 125

Re: [Solved]How to create a PKGBUILD for any application

bstaletic wrote:

It means libpth.so.20 is not found on your system and, since bricscad is linked against it, execution fails. Find which package provides that file and put the name of the package in depends array of your PKGBUILD. For testing just install the package providing libpth.

The package is probably called libpth, but you can find out with

pkgfile libpth.so.20

Ok, I installed core/pth and then I had to symlink libpth.so.20 to bricscad installation folder. Anyway, Thanks! I will mark it as solved. I suppose i can upload it to aur somehow.

Offline

#8 2015-12-22 19:23:41

Xyne
Forum Fellow
Registered: 2008-08-03
Posts: 6,965
Website

Re: [Solved]How to create a PKGBUILD for any application

  • Remove empty variables from the PKGBUILD.

  • Remove the remaining commented lines from the PKGBUILD proto.

  • Fill in the url variable.

  • You don't need to unpack the source archive manually in the build function. Makepkg will do that for you.

  • Use double-quotes around path variables and any other variable the value of which may contain a space, e.g. "${srcdir}".

There are still some problems with this package, such as the alleged need to symlink the pth lib directly into the installation directory. I suspect that there is a better way to do it.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

Board footer

Powered by FluxBB