You are not logged in.

#1 2022-06-05 07:04:52

cdwijs
Member
Registered: 2010-04-24
Posts: 289

[SOLVED] Making a PKGBUILD for Gmsh

I would like to add a PKGBUILD for Gmsh, so I can use the FreeCAD FEM workbench as described here: "FreeCAD FEM Tutorial - Getting a result" https://www.youtube.com/watch?v=Pt870A2nFDo

First I downloaded the source from here: http://gmsh.info/src/gmsh-4.10.3-source.tgz
Then I issued the following commands:

$ tar -xf gmsh-4.10.3-source.tgz
$ cd gmsh-4.10.3-source
$ mkdir build
$ cd build/
$ cmake -DENABLE_BUILD_DYNAMIC=1 ../
$ make

This builds correctly, so the next step is to express this in a PKGBUILD file.

Last edited by cdwijs (2022-06-05 20:00:29)

Offline

#2 2022-06-05 07:33:34

cdwijs
Member
Registered: 2010-04-24
Posts: 289

Re: [SOLVED] Making a PKGBUILD for Gmsh

I'm getting close, the PKGBUILD now downloads the source, and compiles correctly, but it does not install correctly.

The error:

[ 98%] Built target x3_cpp
[ 98%] Built target x5_cpp
[100%] Built target x7_cpp
[100%] Built target x6_cpp
Install the project...
-- Install configuration: "RelWithDebInfo"
-- Installing: /usr/local/bin/gmsh
CMake Error at cmake_install.cmake:52 (file):
  file INSTALL cannot copy file
  "/home/cedric/Downloads/pkg/src/gmsh-4.10.3-source/build/gmsh" to
  "/usr/local/bin/gmsh": Permission denied.


make: *** [Makefile:130: install] Error 1
==> ERROR: A failure occurred in package().
    Aborting...

The PKGBUILD

# Maintainer: Cedric de Wijs <cedric.dewijs@eclipso.eu>

pkgname=gmsh
pkgver=4.10.3
pkgrel=1
pkgdesc="Gmsh: A three-dimensional finite element mesh generator with built-in pre- and post-processing facilities"
arch=('x86_64')
url="http://gmsh.info/"
license=('GPL2+')
depends=()
optdepends=()
makedepends=()
checkdepends=()

source=("http://gmsh.info/src/gmsh-${pkgver}-source.tgz")

sha256sums=('a87d59ccea596d493d375b0d6bc380079a5e5a4baebf0d3383018b0cd6bd8e33')

build()
{   
    msg "Building..."
	cd "${srcdir}/gmsh-${pkgver}-source/"
	mkdir -p build
	cd build
	cmake -DENABLE_BUILD_DYNAMIC=1 ../
	make
	msg2 "Build complete"
}

package() 
{
	msg "Copying files"
	cd "${srcdir}/gmsh-${pkgver}-source/build"
    make install
    msg2 "Done"  
}

Offline

#3 2022-06-05 08:12:47

a821
Member
Registered: 2012-10-31
Posts: 381

Re: [SOLVED] Making a PKGBUILD for Gmsh

you need to use:

make install DESTDIR="$pkgdir"

in package()

At a glance: license should be "GPL" for "GPL2 or greater" according to the guidelines. Remove empty arrays. Don't use msg/msg2 as they are internal functions that can disappear any time; use echo instead.

Edit: You can use the -B flag of cmake and the -C flag of make to skip the "mkdir build; cd build". Also, set the install prefix to /usr instead of /usr/local. Something like

        cd "gmsh-${pkgver}-source/"
	cmake -DENABLE_BUILD_DYNAMIC=1 -DCMAKE_INSTALL_PREFIX=/usr -B build
	make -C build

Edit2: What about https://aur.archlinux.org/packages/gmsh ?

Last edited by a821 (2022-06-05 08:38:43)

Offline

#4 2022-06-05 12:04:46

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Making a PKGBUILD for Gmsh

You shouldn't have the name of the package in the pkgdesc field...
https://wiki.archlinux.org/title/PKGBUILD#pkgdesc

Edit - As a821 pointed out, it's already in the AUR.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#5 2022-06-05 20:00:00

cdwijs
Member
Registered: 2010-04-24
Posts: 289

Re: [SOLVED] Making a PKGBUILD for Gmsh

I am an idiot. I thought I had searched for it on both aur and the normal packages, but it turns out I didn't.

Thanks for the help.

Offline

Board footer

Powered by FluxBB