You are not logged in.
Pages: 1
Hi - new to Arch and trying to learn how to build packages. I've read the wiki pages and tried to follow closely to build a very simple package to install 1 text file from a local source.
I've made a folder at
/home/gotit/Pkg1Inside that folder I have a text file named Pkg1.txt
Also inside that folder I have a PKGBUILD with the following content
pkgname=Pkg1
pkgver=1.0
pkgrel=1
pkgdesc="First package test build"
arch=(i686)
license=('unknown')
source=("$Pkg1.txt")
depends=()
build() {
make
}
package() {
make DESTDIR="$Pkg1dir/" install
}when I run pkgbuild in that directory I get
==> ERROR: Pkg1 is not available for the 'x86_64' architecture.
==> ERROR: An unknown error has occurred. Exiting...I've spent several days trying to get this to work, Pointers anyone?
Thanks!
Last edited by Gotit (2017-05-03 23:06:25)
Offline
There are several problems with your PKGBUILD, but you are getting the error because you are trying to build on a 64-bit system when $arch describes it as a 32-bit package.
Other issues...
$pkgname should be all lower case.
$source should just be Pkg1.txt (without the $)
Your missing a *sums variable
Your build and package functions wont work.
As a minimum you should read and understand...
https://wiki.archlinux.org/index.php/Cr … a_PKGBUILD
https://wiki.archlinux.org/index.php/PKGBUILD
https://wiki.archlinux.org/index.php/Ar … _standards
Last edited by Slithery (2017-04-27 23:06:01)
Offline
You need to consider each line of the PKGBUILD and why it's there (or shouldn't be). For the architecture, you have explicitly made it an i686-only package so makepkg correctly detects that it cannot be built on your system (according to the metadata you have given). (Re)read the "arch" section of the PKGBUILD wiki page. Hint: is there anything architecture-specific about a text file?
Remove the empty "depends" array. It servers no purpose.
Your build and package functions make no sense. "make" is a command to compile software from source code, based on a "Makefile". You have nothing to compile, no source code and no Makefile. There is nothing to build, so you do not need a build function. For the package function, you will only need the "install" command. Take a peak at some other PKGBUILDs and you will quickly find some good examples.
You should also include checksums for the source file. See the PKGBUILD wiki page linked above. I recommend using the strongest hash (currently sha512) just to develop the habit for later.
I also agree with the comments above.
Moderator note: moved to NC.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Much better, thanks!
My PKGBUILD now looks like this
pkgname=first_pkg
pkgver=1.0
pkgrel=1
pkgdesc="First package test build"
arch=('any')
license=('unknown')
source=("pkg_tst_file.txt")
sha256sums=('c7be1ed902fb8dd4d48997c6452f5d7e509fbcdbe2808b16bcf4edce4c07d14e')
package() {
#DESTDIR="$gotitdir/" # install
}Offline
package() { #DESTDIR="$gotitdir/" # install }
The rest of the PKGBUILD is better but this makes no sense. Any line in Bash that starts with "#" is a comment so your package function does nothing. You need to use e.g. the install command to install files to "$pkgdir", which will be set to the correct directory for creating the package. You recreate the hierarchy in $pkgdir that you want to see on your system when the package is installed. For example, let's say that your source files are in an archive named foo.tar.gz and when you unpack it, you get a single file in the unpacked archive named my_awesome_script. If you want to install that to the system's /usr/bin directory to make it accessible via your path, you could use this:
package()
{
install -Dm755 "$srcdir/foo/my_awesome_script" "$pkgdir/usr/bin/my_awesome_script"
}Read up on the different path variables available in the PKGBUILD and build some existing packages (get the PKGBUILDs from ABS or the AUR). Look at each command, and check the results in the created package and intermediate directories to see what they do.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Pages: 1