You are not logged in.

#1 2018-10-11 09:31:18

funkaddict
Member
Registered: 2018-08-13
Posts: 106

How to install a program from github

Hey there,

I am trying to install OpenFAST which is a multi-physics simulation code for (floating offshore) wind turbines. I have done as explained in the respective documentation:

# obtain the source code; e.g., from the command line using git:
git clone https://github.com/OpenFAST/OpenFAST.git

# go to the OpenFAST directory
cd OpenFAST

# create a directory called `build`
mkdir build

# go to the build directory
cd build

# execute cmake with the default options, which will create a Makefile
cmake ../

# execute a make command (with no target provided, equivalent to `make all`
make

So I am wondering, after building the program, how to actually install and make it executable. I have run the predecessor (FAST) on windows before. But back then it was just an .exe file to install. So I am struggling now how to actually install the program.

Offline

#2 2018-10-11 10:26:11

teckk
Member
Registered: 2013-02-21
Posts: 518

Offline

#3 2018-10-11 13:11:25

funkaddict
Member
Registered: 2018-08-13
Posts: 106

Re: How to install a program from github

Thank you,

so obtaining, building and installing software from github could be divided into the following steps:

1. Obtaining source code from github
E.g. by

 git clone https://github.com/OpenFAST/OpenFAST.git 

or by downloading the respective zipfile and unzipping it.
2. Build the package

mkdir build

cd build

cmake ../

make

3. Create the PKGBUILD
4. Make the package via makepkg
5. Install the package via pacman

But as far as I understood, I do not need to manually download the source from github. This can be written into PKGBUILD, correct? So I could skip 1. and 2. and just starting by creating the PKGBUILD?

What I don´ t understand here is the following from the Wiki creating packages:

Download the source tarball of the software you want to package, extract it, and follow the author's steps to install the program. Make a note of all commands and/or steps needed to compile and install it. You will be repeating those same commands in the PKGBUILD file.

Most software authors stick to the 3-step build cycle:

./configure
make
make install

This is a good time to make sure the program is working correctly.

So, by doing

make

and

make install

I would already install the the program compiled by step 2. Or am I wrong? Thus, steps 3-5 are only necessary if I´ d like to provide a package with the respective software to other users e.g. to the AUR. But hereby I get confused because I learned that I should not install software to the system without using pacman.

Last edited by funkaddict (2018-10-11 13:22:29)

Offline

#4 2018-10-11 13:25:01

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: How to install a program from github

funkaddict wrote:

1. Obtaining source code from github
2. Build the package
3. Create the PKGBUILD
4. Make the package via makepkg
5. Install the package via pacman

No.  Step 1 is to make the PKGBUILD (using the github url for the source array and the comands to build in the build function).  Step 2 is to build the package with makepkg which can also be given the -i flag to install the newly built package so there would be no step 3.  If you don't use the -i flag for makepkg, step 3 is to install it with pacman.  There is never any need to directly download the source (makepkg does this) or run the build commands (makepkg also does this assuming you've written a build function).

This should be a very easy PKGBUILD to write, so it will be a good first experience with PKGBUILDs.  If you provide a draft of your PKGBUILD here (in code tags) we can ensure you've got it right before you move on to step 2.

funkaddict wrote:

I would already install the the program compiled by step 2. Or am I wrong? Thus, steps 3-5 are only necessary if I´ d like to provide a package with the respective software to other users e.g. to the AUR. But hereby I get confused because I learned that I should not install software to the system without using pacman.

"Install" has two different meanings here.  You should never directly run `sudo make install` in arch.  That will copy the files to your root filesystem, but it will circumvent your package manager and it will almost certainly cause problems in the future (if no other problems, it may be hard to cleanly uninstall the software).  Using a PKGBUILD is not just for sharing it with other users - rather using a PKGBUILD allows pacman to track your built package, prevent conflicts, and ease in managing (upgrading / uninstalling) the software.

Last edited by Trilby (2018-10-11 13:31:13)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2018-10-11 13:59:53

funkaddict
Member
Registered: 2018-08-13
Posts: 106

Re: How to install a program from github

Trilby wrote:

No.  Step 1 is to make the PKGBUILD (using the github url for the source array and the comands to build in the build function).  Step 2 is to build the package with makepkg which can also be given the -i flag to install the newly built package so there would be no step 3.  If you don't use the -i flag for makepkg, step 3 is to install it with pacman.  There is never any need to directly download the source (makepkg does this) or run the build commands (makepkg also does this assuming you've written a build function).

This should be a very easy PKGBUILD to write, so it will be a good first experience with PKGBUILDs.  If you provide a draft of your PKGBUILD here (in code tags) we can ensure you've got it right before you move on to step 2.

Thank you for the clarification. I will read and try to write the PKGBUILD.

Trilby wrote:

"Install" has two different meanings here.  You should never directly run `sudo make install` in arch.  That will copy the files to your root filesystem, but it will circumvent your package manager and it will almost certainly cause problems in the future (if no other problems, it may be hard to cleanly uninstall the software).  Using a PKGBUILD is not just for sharing it with other users - rather using a PKGBUILD allows pacman to track your built package, prevent conflicts, and ease in managing (upgrading / uninstalling) the software.

That makes sense and this coincides with what I have already learned about how to maintain Arch properly. I I have tried to 'make install' it yesterday, but without 'sudo' So luckily, I think I by this error, I did not cause any harm to the system, right? How can I check if there have been installed any packages going the unproper way?

Offline

#6 2018-10-11 14:31:24

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: How to install a program from github

funkaddict wrote:

I have tried to 'make install' it yesterday, but without 'sudo' So luckily, I think I by this error, I did not cause any harm to the system, right?

Pretty much right.  Assuming you were not logged in as root at the time, `make install` by itself can't touch anything in your root filesystem.  Most likely it would just fail to do anything, but this depends a bit on exactly what is in the makefile.  Theoretically, the `make install` command could still have littered content around your user's home folder, but if the makefile was generated by cmake as indicated above, then this is unlikely.

funkaddict wrote:

How can I check if there have been installed any packages going the unproper way?

That's the problem, there is (was) no practical way to do this other than just exploring around in your root filesystem looking for anything odd.  There is now a tool called `lostfiles` in [community] which is designed to find files not tracked by pacman.  I don't have direct experience with it, but the author of the tool is an active and knowledgeable archer.

EDIT: note about `lostfiles` - it will almost certainly provide false positives: do not just delete everything that it reports as untracked by pacman.  Just consider them candidates for further investigation.  Anything listed by `lostfiles` under /usr/bin would be particularly suspicious though; entries under /etc are more likely to be expected and should be left be; entries under /usr/share could be a mixed bag.

Last edited by Trilby (2018-10-11 14:52:27)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2018-10-11 18:36:14

funkaddict
Member
Registered: 2018-08-13
Posts: 106

Re: How to install a program from github

Trilby wrote:

but if the makefile was generated by cmake as indicated above, then this is unlikely.

Okay, that sounds plausible.

Trilby wrote:

That's the problem, there is (was) no practical way to do this other than just exploring around in your root filesystem looking for anything odd.  There is now a tool called `lostfiles` in [community] which is designed to find files not tracked by pacman.  I don't have direct experience with it, but the author of the tool is an active and knowledgeable archer.

EDIT: note about `lostfiles` - it will almost certainly provide false positives: do not just delete everything that it reports as untracked by pacman.  Just consider them candidates for further investigation.  Anything listed by `lostfiles` under /usr/bin would be particularly suspicious though; entries under /etc are more likely to be expected and should be left be; entries under /usr/share could be a mixed bag.

I will have a look into 'lostfiles' just for curiousity. And will keep your suggestions in mind.

Tomorrow I will have the time to write the PKGBUILD. I want to be more certain what I am doing. I will post it here as soon as I finish it.

Offline

#8 2018-10-12 10:33:35

funkaddict
Member
Registered: 2018-08-13
Posts: 106

Re: How to install a program from github

So I have written the PKGBUILD and have plenty of questions wink

# Maintainer: Your Name <youremail@domain.com>

pkgname=openfast
pkgver=1.0.0
pkgrel=1
epoch=
pkgdesc="OpenFAST from NREL - wind turbine simulation code"
arch=('any') not certain
url="https://github.com/OpenFAST/${pkgname}"
license=('LICENSE-APACHE')
depends=(
	'lapack' 
	'blas' 
	'hdf5' 
	'yaml-cpp'
	)
makedepends=(
	'gcc-fortran>=6.1.0'
	'gcc' 
	'cmake >=2.8.12'
	)
checkdepends=()
optdepends=(
	'python>=3.0.0'
	)
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/OpenFAST/${pkgname}")
noextract=()
md5sums=()
validpgpkeys=()
build() {
	cd "$pkgname-$pkgver"
	git clone "https://github.com/OpenFAST/OpenFAST.git"
	cd OpenFAST
	mkdir build
	cd build
	cmake ../
	./configure --prefix=/usr
	make
}

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

package() {
	cd "$pkgname"
	make DESTDIR="$pkgdir/" install
}

Is it better to remove these entries or just let the value blank (like I did)?

- I guess the pkgname should always be written without capital letters, correct?
- arch= I think this is not defined here anyway arch is only support x64. So 'any' is correct here?
- url= I think pkgname is sufficient, I don´ t need to call the versionnumber?
- licence= I found several examples regarding different licenses, but how to call the apache licence here?
- are the depends, makedepends and optdepends correct, when refering to OpenFAST Build instructions?
- I couldn´t find a md5sum for the package, but I think it makes sense to set this up. Is there another option to find this out?

Also I am wondering if I need an additional .install file. As far as I understood the PKGBUILD does define anything which is necessary to build the package.

Offline

#9 2018-10-12 11:08:59

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: How to install a program from github

Is it better to remove these entries or just let the value blank (like I did)?

Remove what you do not need, empty variables clutter the PKGBUILD.

- I guess the pkgname should always be written without capital letters, correct?

Yes. If you use a git repository, then you should append "-git" as well

- arch= I think this is not defined here anyway arch is only support x64. So 'any' is correct here?

No, you have to use x86_64. https://wiki.archlinux.org/index.php/PKGBUILD#arch

- url= I think pkgname is sufficient, I don´ t need to call the versionnumber?

yes.

- licence= I found several examples regarding different licenses, but how to call the apache licence here?

Since apache is part of the [core]/licenses package, you look for the name in /usr/share/licenses/common/, see "Apache" and use that.
https://wiki.archlinux.org/index.php/PKGBUILD#license

- I couldn´t find a md5sum for the package, but I think it makes sense to set this up. Is there another option to find this out?

You are mixing up a git build and a build from an archive with a specific release.
Do not clone the git repository in the build function. Use it as the source, create a pkgver() function to get the version from the git clone and append "-git" to your package name. https://wiki.archlinux.org/index.php/VC … guidelines

Alternatively use the archive for the tagged 1.0.0 release and set the checksum for it , preferably sha256sum.
https://wiki.archlinux.org/index.php/PKGBUILD#Integrity

Last edited by progandy (2018-10-12 11:53:53)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Online

#10 2018-10-12 11:39:39

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: How to install a program from github

pkgdesc="OpenFAST from NREL - wind turbine simulation code"

pkgdesc shouldn't contain pkgname in it, use something like wind turbine simulation code from  US NREL

-------------------
The versions in these dependencies can be omitted, archlinux is way ahead of those requirements.
Also it's ok to put multiple depends on one line.


Check the build instructions section called "Current CMake options" .
The defaults for several options listed there are not what you/archlinux prefer.
example : shared libraries should be on by default

Given the imo questionable defaults upstream uses, I'd suggest you look into their CMakeLists.txt .
The choices you make will influence which deps are needed.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#11 2018-10-12 12:00:49

funkaddict
Member
Registered: 2018-08-13
Posts: 106

Re: How to install a program from github

Thank you,

I think I have included the relevant changes:

# Maintainer: Your Name <youremail@domain.com>

pkgname=openfast-git
pkgver=1.0.0
pkgrel=1
epoch=
pkgdesc="aeroelastic CAE-Tool for horizontal axis wind turbines from US NREL"
arch=('x86_64')
url="https://github.com/OpenFAST/${pkgname}"
license=('Apache')
depends=(
	'lapack' 
	'blas' 
	'hdf5' 
	'yaml-cpp'
	)
makedepends=(
	'gcc-fortran>=6.1.0'
	'gcc' 
	'cmake >=2.8.12'
	)
checkdepends=()
optdepends=(
	'python>=3.0.0'
	)

source=("${pkgname}.tar.gz::https://github.com/OpenFAST/${pkgname}")

pkgver() {
  cd "$pkgname"
  git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
	cd "$pkgname"
	cd OpenFAST
	mkdir build
	cd build
	cmake ../
	./configure --prefix=/usr
	make
}

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

package() {
	cd "$pkgname"
	make DESTDIR="$pkgdir/" install
}

The following questions occur:

1. In PKGBUILD-vcs.proto#n33 it reads:

makedepends=('VCS_PACKAGE') # 'bzr', 'git', 'mercurial' or 'subversion'

so do I have to include the package which I want to build as a dependent?

2. Did I define the depends correctly? I distinguished depends makedepends and optdepends in accordance to OpenFAST Build Instructions

3. The variable in

 source= 

is pkgname but it is defined as openfast-git above. So an url pointing towards that package on github would not make any sense as https://github.com/OpenFAST/openfast-git does not exist but /openfast does. So should i define the url for the source absolute here?

Edit:
Refering to question #3, I found an option to use two different variables for the pkgname pkgname and pkgname as suggested here . Does this make sense?

Last edited by funkaddict (2018-10-12 12:36:27)

Offline

#12 2018-10-12 12:46:48

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: How to install a program from github

funkaddict wrote:

Edit:
Refering to question #3, I found an option to use two different variables for the pkgname pkgname and pkgname as suggested here . Does this make sense?

It makes sense, but since you only need the name in the URLs, it doesn't really matter. Both of these options are acceptable, but it is probably a good idea to also include provides and conflicts for the non-git version in case someone wants to upload that to the AUR.

_pkgname=openfast
pkgname=${_pkgname}-git
url="https://github.com/OpenFAST/${_pkgname}"
source=("${pkgname}::https://github.com/OpenFAST/${_pkgname}")
provides=(${_pkgname})
conflicts=(${_pkgname})

Edit: And don't append .tar.gz to the local name for the git repository.

Last edited by progandy (2018-10-12 12:49:44)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Online

#13 2018-10-12 13:46:57

funkaddict
Member
Registered: 2018-08-13
Posts: 106

Re: How to install a program from github

Okay, so I think I am done with the PKGBUILD:

# Maintainer: Your Name <youremail@domain.com>

_pkgname=openfast
pkgname=${_pkgname}-git
pkgver=1.0.0
pkgrel=1
epoch=
pkgdesc="Aero-hydro-servo-elastic CAE-Tool for horizontal axis wind turbines from US NREL"
arch=('x86_64')
url="https://github.com/OpenFAST/${_pkgname}"
license=('Apache')
depends=(
	'lapack' 
	'blas' 
	'hdf5' 
	'yaml-cpp'
	)
makedepends=(
	'gcc-fortran>=6.1.0'
	'gcc' 
	'cmake >=2.8.12'
	)
optdepends=(
	'python>=3.0.0'
	)

source=("${_pkgname}::https://github.com/OpenFAST/${_pkgname}")
provides=(${_pkgname})
conflicts=(${_pkgname})

pkgver() {
  cd "$pkgname"
  git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
	cd "$pkgname"
	cd OpenFAST
	mkdir build
	cd build
	cmake ../
	./configure --prefix=/usr
	make
}

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

package() {
	cd "$pkgname"
	make DESTDIR="$pkgdir/" install
}
progandy wrote:

in case someone wants to upload that to the AUR.

Well I allways like to contribute as I really love the idea about open source and supporting each other. That´ s what me drove to move from windows to Ubuntu several years ago, to Manjaro two years ago and a couple of weeks ago finally to Arch. However, I think there is a very, very little user group for OpenFAST on Arch. The majority of the engineers/researchers, who are working in a field with a close connection to the industry still stick to windows. This applies also for the developers/users of FAST/OpenFAST.

I have tested the package using namcap:

$ namcap -i PKGBUILD
PKGBUILD (openfast-git) E: Missing checksums
PKGBUILD (openfast-git) I: Missing Contributor tag

I think that´ s okay? The hint concerning checksums can be skiped as this PKGBUILD is made to get the sources from github, right?

Offline

#14 2018-10-12 13:54:18

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: How to install a program from github

This is a great start to a PKGBUILD - with a couple more revisions it should be ready to go.

1. There is no reason here to rename the local git repo in the source line (though it's harmless).  But you do need to specify either a git url or a git+https url:

source=("git://github.com/OpenFAST/${_pkgname}")
# or
#source=("git+https://github.com/OpenFAST/${_pkgname}")

2. Remove the empty epoch variable

3. Remove versioned depenencies as they are redundant on an arch system - occasionally versioned dependencies are needed to specify a depedence on a specific version or on a range of versions which are not currently in the arch repositories.  But in arch `python` is python3 an thus implies ver > 3.0.0.  And cmake in the repos is already *much* newer than the minimum required in your PKGBUILD.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#15 2018-10-12 14:06:34

Morganamilo
Package Maintainer (PM)
Registered: 2017-12-05
Posts: 77

Re: How to install a program from github

funkaddict wrote:

I have tested the package using namcap:

namcap will point out common mistakes. You should also see if makepkg succeeds in building the package though, preferably in a clean chroot.

You're missing a makedep on git.

Checksums are required, you just set the checksum as 'SKIP', not leave out the variable.

For optdepends it's nice to say why they might be needed.

Offline

#16 2018-10-12 14:12:35

funkaddict
Member
Registered: 2018-08-13
Posts: 106

Re: How to install a program from github

Trilby wrote:

This is a great start to a PKGBUILD - with a couple more revisions it should be ready to go.

That´ s cool, thank to you and the others, supporting.

Trilby wrote:

1. There is no reason here to rename the local git repo in the source line (though it's harmless).  But you do need to specify either a git url or a git+https url:

source=("git://github.com/OpenFAST/${_pkgname}")
# or
#source=("git+https://github.com/OpenFAST/${_pkgname}")

Ok, I have applied that. So I made a node to me to read/learn more about git

Trilby wrote:

2. Remove the empty epoch variable

Don´ t know where this suddenly came up from again. Anyway, removed.

Trilby wrote:

3. Remove versioned depenencies as they are redundant on an arch system - occasionally versioned dependencies are needed to specify a depedence on a specific version or on a range of versions which are not currently in the arch repositories.  But in arch `python` is python3 an thus implies ver > 3.0.0.  And cmake in the repos is already *much* newer than the minimum required in your PKGBUILD.

That makes a lot of sense. Thank You.


# Maintainer: Your Name <youremail@domain.com>

_pkgname=openfast
pkgname=${_pkgname}-git
pkgver=1.0.0
pkgrel=1
pkgdesc="Aero-hydro-servo-elastic CAE-Tool for horizontal axis wind turbines from US NREL"
arch=('x86_64')
url="https://github.com/OpenFAST/${_pkgname}"
license=('Apache')
depends=(
	'lapack' 
	'blas' 
	'hdf5' 
	'yaml-cpp'
	)
makedepends=(
	'gcc-fortran'
	'gcc' 
	'cmake'
	)
optdepends=(
	'python'
	)

source=("git:github.com/OpenFAST/${_pkgname}")
provides=(${_pkgname})
conflicts=(${_pkgname})

pkgver() {
  cd "$pkgname"
  git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
	cd "$pkgname"
	cd OpenFAST
	mkdir build
	cd build
	cmake ../
	./configure --prefix=/usr
	make
}

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

package() {
	cd "$pkgname"
	make DESTDIR="$pkgdir/" install
}

I assume I have to move the PKGBUILD into a directory with the name as defined in the PKGBUILD, so in this case this would be openfast-git and run makepkg here.

Last edited by funkaddict (2018-10-12 14:12:43)

Offline

#17 2018-10-12 14:18:12

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: How to install a program from github

funkaddict wrote:

I assume I have to move the PKGBUILD into a directory with the name as defined in the PKGBUILD, so in this case this would be openfast-git and run makepkg here.

No, that's not necessary, but also not a bad idea.  It can be anywhere.  When you retrieve a PKGBUILD from the aur this is what you will get, but this is just how the AUR is organized.  The PKGBUILD can be anywhere (or anywhere you have write access) - you just need to run makepkg from the same directory as the PKGBUILD.

Of course this will create a few subdirectories and files there, so it is helpful to put the PKGBUILD in it's own directory before running makepkg just to avoid cluttering any other location.

Last edited by Trilby (2018-10-12 14:18:42)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#18 2018-10-12 14:34:30

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: How to install a program from github

The PKGBUILD you posted will fail, but that failure is easy to solve.
Worse is that you ignored the most important part of #10, which will lead to an openfast installation with several disadvantages and very limited functionality.


I advise you to :

- take a long walk or other type of  break
- once break is over, thoroughly read https://openfast.readthedocs.io/en/mast … linux.html atleast 2 times completely

If you don't see the error in the build() function by now , run makepkg and solve the error.

tell us what things you'll be missing in the software if you build with cmake default settings as set by upstream.

Last edited by Lone_Wolf (2018-10-12 14:48:41)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#19 2018-10-12 14:35:14

funkaddict
Member
Registered: 2018-08-13
Posts: 106

Re: How to install a program from github

Trilby wrote:
funkaddict wrote:

I assume I have to move the PKGBUILD into a directory with the name as defined in the PKGBUILD, so in this case this would be openfast-git and run makepkg here.

No, that's not necessary, but also not a bad idea.  It can be anywhere.  When you retrieve a PKGBUILD from the aur this is what you will get, but this is just how the AUR is organized.  The PKGBUILD can be anywhere (or anywhere you have write access) - you just need to run makepkg from the same directory as the PKGBUILD.

Of course this will create a few subdirectories and files there, so it is helpful to put the PKGBUILD in it's own directory before running makepkg just to avoid cluttering any other location.

Ok, but then I am wondering about

build() {
	cd "$pkgname"
	cd OpenFAST
	mkdir build
	cd build
	cmake ../
	./configure --prefix=/usr
	make
}

First I am moving to "$pkgname" which in this case is openfast-git then I am moving to OpenFAST. I think

	cd OpenFAST

is obsolete here, isn´t it?

Edit:

And just to make sure that I have acutally understood what I am doing here:

When I run makepkg in, let´ s say /home/user/additionalpackages/openfast/ where the PKGBUILD is located, it will:

- download the source code:

source=("git:github.com/OpenFAST/${_pkgname}")

- change directory into  /home/user/additionalpackages/openfast/openfast

cd "$pkgname"

Last edited by funkaddict (2018-10-12 14:41:19)

Offline

#20 2018-10-12 14:47:06

funkaddict
Member
Registered: 2018-08-13
Posts: 106

Re: How to install a program from github

Lone_Wolf wrote:

DON"T OVERLOOK THIS
(yellow highlight will be removed once it's clear funkaddict has noticed it)


The PKGBUILD you posted will fail, but that failure is easy to solve.
Worse is that you ignored the most important part of #10, which will lead to an openfast installation with several disadvantages and very limited functionality.

Indeed, I am sorry I overlooked the part below the strokes in #10

Lone_Wolf wrote:

I advise you to :

- take a long walk or other type of  break
- once break is over, thoroughly read https://openfast.readthedocs.io/en/mast … linux.html atleast 2 times completely

If you don't see the error in the build() function by now , run makepkg and solve the error.

tell us what things you'll be missing in the software if you build with cmake default settings as set by upstream.

I will do so, and will come back to the topic later. After getting my head clear smile

Offline

#21 2018-10-12 15:52:29

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: How to install a program from github

Good plans above.  There are still revisions to be made.  For cd'ing in the build function, you can try out your PKGBUILD and your attention will first be drawn to the typo and/or missing characters in your source array, but once that is remedied, you can check the "src" folder that is created to see what is actually there: the source is under "openfast" which is ${_pkgname} so you can just start the build (and package) functions with `cd "${_pkgname}"`. [EDIT: note that the functions in the PKGBUILD all start in $srcdir which is - under standard configurations - the "src" directory created wherever you ran makepkg from.]


This may see like a long processes, but openfast for the most part follows standard installation processes; so once you understand how this PKGBUILD is made, you will be much more equipped to make others in the future.   Eventually it becomes trivially easy to grab a PKGBUILD template, change a few things, and get a package built (assuming no quirks in the upstream source).

I'll also note how well you are accepting some rather direct constructive criticism.  Keep that up.  I'm generally known around here for being quite abrasive, but I separate those who are willing and able to learn (as funkaddict is proving to be) versus the occasional user who is just lazy: the former just needs guidance, the latter are those I'll show to the door ... and give a few shoves in it's direction.

Last edited by Trilby (2018-10-12 15:57:11)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#22 2018-10-13 08:17:48

funkaddict
Member
Registered: 2018-08-13
Posts: 106

Re: How to install a program from github

Well,

I have read the openfast install guide again, twice. What came into my mind was:

1. The depends were probably not accurate. So I moved hdf5 and yaml to optdepends, where I think they belong. And added make to the makedepends

2. In the build() function I removed the line

cd OpenFAST

3. Furthermore I thought there should be added a line which reads

mkdir "$pkgname"

because this directory was never created in the PKGBUIILD. This should be done before the build() function as it is also necessary for pkgver(). So should I include a

mkdir "$pkgname"

. - Edit: As far as I understand now, this is not necessary.

4. I have to add the cmake build instructions as suggested by Lone_Wolf in Post #10. I assume BUILD_SHARED_LIBS - Enable building shared libraries (Default: OFF)   to be of special importance here. Furthermore I added

--BUILD_DOCUMENTATION=ON

and

--BUILD_TESTING=ON

out of curiousity and as I think the TESTING function makes sense and I want to try that.

5. Finally, I wonder that makepkg never gets the order to actually clone the source

git clone https://github.com/OpenFAST/OpenFAST.git

. But when having a look into the AUR where different PKGBUILDs for several -github located packages can be found I see that this is not necessary.

Just to keep this up-to-date the current state of the PKGBUILD:

# Maintainer: Your Name <youremail@domain.com>

_pkgname=openfast
pkgname=${_pkgname}-git
pkgver=1.0.0
pkgrel=1
pkgdesc="Aero-hydro-servo-elastic CAE-Tool for horizontal axis wind turbines from US NREL"
arch=('x86_64')
url="https://github.com/OpenFAST/${_pkgname}"
license=('Apache')
depends=('lapack' 'blas')
makedepends=('gcc-fortran' 'gcc' 'make' 'cmake')
optdepends=('python' 'hdf5' 'yaml-cpp')

source=("git:github.com/OpenFAST/${_pkgname}")
provides=(${_pkgname})
conflicts=(${_pkgname})

pkgver() {
  cd "$pkgname"
  git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
	cd "$pkgname"
	mkdir build
	cd build
	cmake ../
	./configure --prefix=/usr 
		    --BUILD_DOCUMENTATION=ON
		    --BUILD_SHARED_LIBS=ON
		    --BUILD_TESTING=ON 

	make
}

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

package() {
	cd "$pkgname"
	make DESTDIR="$pkgdir/" install
}

Which quits with an error that openfast wasn't found in the build direcotry and is no URL

Trilby wrote:

This may see like a long processes, but openfast for the most part follows standard installation processes; so once you understand how this PKGBUILD is made, you will be much more equipped to make others in the future.   Eventually it becomes trivially easy to grab a PKGBUILD template, change a few things, and get a package built (assuming no quirks in the upstream source).

I'll also note how well you are accepting some rather direct constructive criticism.  Keep that up.  I'm generally known around here for being quite abrasive, but I separate those who are willing and able to learn (as funkaddict is proving to be) versus the occasional user who is just lazy: the former just needs guidance, the latter are those I'll show to the door ... and give a few shoves in it's direction.

I think learning is always a long process. And If I don't want to learn, I'd say I am wrong with Arch Linux. As mentioned above, I went from windows, to ubuntu, to manjaro and now to arch. Because the other OS make it easy for users just go along without thinking what they actually do. So I am doing things, or let the scripts to things what I don't have any idea how they work. Arch, from my beginner-like point of view makes the user to question things and be aware from what he is doing, right from the beginning. Just blind trusting into black-box like systems is not the way I like to go as this approach will cause problems, sooner or later.
There is a very well known commercial finite-element-method (FEM) software around. It's licenses costs about 50-100.000US$ for a single pc. In a workshop (which additionally costs several thousand US$) how to use this software, a colleague asked the lecturer about a single function, which prevents freely floating objects, which have no, or at least not sufficient boundary conditions from disappearing into infinity. The lecturer answered that this is a feature of the program that the user doesn't have to worry about these things. The problem is, that these so called "weak springs" are a black-box system where the user has no influence and no guidance how they even work. But they will have an influence on the results where nobody knows how big they will be. When one designs for example a floating substructure for wind turbines, one must really understand about the characteristics of a software and how the results are generated.
And you guys are spending time to help me learning and to understand how to achieve my goals with Arch. So there is nothing for me to complain, but only to appreciate your support.

EDIT:

As written above. It quits with an error that openfast wasn't found in the build directory and is no URL. So I changed the source line:

source=("$pkgname::git+https://github.com/OpenFAST/${_pkgname}")

Which solves the problem above and starts cloning from github but closes later with an error concerning integrity veryfication for: source

Last edited by funkaddict (2018-10-13 09:06:46)

Offline

#23 2018-10-13 10:30:20

lquidfire
Member
From: South Africa
Registered: 2017-07-26
Posts: 53

Re: How to install a program from github

I am actively following this thread to learn about making PKGBUILDs as well - thanks all for the opportunity.

funkaddict wrote:

Which solves the problem above and starts cloning from github but closes later with an error concerning integrity veryfication for: source

The answer to this was already given by Morganamilo in post #15. Just add

md5sums=(SKIP)

See also the Wiki.

Offline

#24 2018-10-13 11:33:15

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: How to install a program from github

You are making good progress.
I just reread openfast build instructions and they seem to expect users to know how cmake does things.
Cmake does things differently then autotools confgure / make / make install .

- cmake replaces configure
- cmake settings need to have -D prepended to be understood

cmake ../   \
  -DCMAKE_INSTALL_PREFIX=/usr  \
  -DBUILD_DOCUMENTATION=ON \
  -DBUILD_SHARED_LIBS=ON \
  -DBUILD_TESTING=ON

The \   are there to inform bash the command continues on the next line .

------------------------
Dependencies

gcc and make are in base-devel . Having base-devel group installed is a requirement  for building aur packages so those don't need to be mentioned.
(I do realise this package may never be submitted to aur, but rules for aur packages tend to be sane ).

gcc-fortran and cmake should stay and since you're building a -git pacakge git should be added to makedepends.

python , hdf5 and yaml-cpp are a bit trickier.
the build instructions suggest they're needed at build time and as optdep at runtime.
This would make them makedepends AND optdepends .

-------------------
I think you should put your name /contact details as maintainer in this PKGBUILD.
(doesn't have to be your real name, I put Lone_Wolf and lonewolf@xs4all.nl in  my packages).

There are very few threads about openfast on linux on the internet, and this thread / PKGBUILD are likely to show up when people search for openfast linux in the future.

You're doing the work to get it building/running, you should get credit for it.

Edit: typos

Last edited by Lone_Wolf (2018-10-13 11:35:02)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#25 2018-10-13 14:03:36

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: How to install a program from github

source=("git:github.com/OpenFAST/${_pkgname}")
source=("$pkgname::git+https://github.com/OpenFAST/${_pkgname}")

The only really relevant difference is that the first is missing the // after the colon in the url.  The following will work:

source=("git://github.com/OpenFAST/${_pkgname}")

Although prepending "$pkgname::" changes the name of the local repo.

Last edited by Trilby (2018-10-13 14:04:39)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB