Automated compiling & packaging, using Arch Linux build scripts

Moderator: Forum moderators

Post Reply
User avatar
sc0ttman
Posts: 93
Joined: Sat Aug 22, 2020 3:55 pm
Has thanked: 4 times
Been thanked: 33 times

Automated compiling & packaging, using Arch Linux build scripts

Post by sc0ttman »

pkgbuild2pet

I made two scripts that can be used to compile PET packages from Arch Linux build scripts,
called a "PKGBUILD" :thumbup:

  • The first script can download PKGBUILDs for you (a folder full of scripts, patches, etc).
  • The second script can compile PKGBUILDs to PET packages.

Both scripts are in "alpha" state, and need lots more testing, but so far I have successfully
compiled and packaged the following programs using these scripts (in FossaPup64):

azpainter2, azdrawing, eigen, lowdown, cfiles, hardinfo, jgmenu, slop-git, maim, nnn, st, stella,
mupen64plus, scummvm, others...

REQUIRES:

The devx is required!

USAGE:

Get the PKGBUILD for the package you want to build:

Code: Select all

arch-pkgbuild-download azdrawing        # download PKGBUILD stuff to /usr/local/src/arch/azdrawing

Build the PKGBUILD to a PET package:

Code: Select all

arch-pkgbuild-compile azdrawing       # compile Az Drawing program, and package it up as a PET

About downloading PKGBUILDs:

3 sources are used:

  • the official repos (via svn),
  • the community repos (via svn)
  • and PKGBUILD .tar.gz snapshots from the Arch Linux site (curl or wget)

arch-pkgbuild-download will create and use these dirs:

Code: Select all

/usr/local/src/arch/packages/   <-- the core, extra repos (svn), containing PKGBUILDs
/usr/local/src/arch/community/  <-- the community repo (svn), containing PKGBUILDs

/usr/local/src/arch/<pkgname>/  <-- tar.gz PKGBUILD snapshots pulled from svn end up here

About compiling PKGBUILDs:

Once you have a PKGBUILD downloaded, such as: /usr/local/src/arch/hardinfo/PKGBUILD

You can compile it and create a PET like so:

Code: Select all

arch-pkgbuild-compile hardinfo

Download, Compile and Package in "one go"

Using these scripts, you can do the downloading, compiling and PET packaging in one go with a simple function:

Code: Select all

function pkgbuild2pet { arch-pkgbuild-download "$@" && arch-pkgbuild-compile "$1"; }

Then use it like so:

Code: Select all

pkgbuild2pet azpainter -y

=====================

Scripts attached below

Attachments
arch-pkgbuild-scripts.tar.gz
extract and make scripts executable, put them in your $PATH
(20 KiB) Downloaded 102 times
Last edited by sc0ttman on Thu Nov 26, 2020 10:34 pm, edited 7 times in total.
User avatar
sc0ttman
Posts: 93
Joined: Sat Aug 22, 2020 3:55 pm
Has thanked: 4 times
Been thanked: 33 times

Re: Automated compiling & packaging, using Arch Linux build scripts

Post by sc0ttman »

NOTES:

1. when searching for deps, you will get lots of "Package not found in any repos"

...this is (mainly) cos Arch Linux uses slightly different names for packages.

2. Lots of things won't build.

...but at least they're (mostly) compiling errors, usually related to missing deps.

3. You can always use `pkg` to find the missing deps in your system repos.

4. These scripts might work best on ArchPup, I've no idea.

5. Your created PETs end up in /usr/local/src/arch/<pkgname>/

6. The builds only log errors and warning from `configure` and `make`, to filter out stuff you dont need to see.

7. All errors from the file config.log are printed to terminal if a biuld fails, and the file exists.

8. dir2pet is called at the end to make the PET package - it could be ran without the need for user input, but I didn't do that bit yet.

Last edited by sc0ttman on Mon Nov 23, 2020 8:53 pm, edited 1 time in total.
User avatar
sc0ttman
Posts: 93
Joined: Sat Aug 22, 2020 3:55 pm
Has thanked: 4 times
Been thanked: 33 times

Re: Automated compiling & packaging, using Arch Linux build scripts

Post by sc0ttman »

I forgot, this script is used by the other two, for extracting archive files, so you need this too...

Save as extract, make it executable, and save it in your $PATH.

Code: Select all

#!/bin/bash

# easier archive file extraction
if [ ! -f "$1" ] ; then
  echo "'$1' is not a valid file!" >&2
  exit 1
fi

NAME="$(dirname "$1")"
mkdir "$NAME" && cd "$NAME"

case "$1" in
  *.tar.bz2) tar xvjf "$1" ;;
  *.tar.gz) tar xvzf "$1" ;;
  *.tar.xz) tar xvJf "$1" ;;
  *.lzma) unlzma "$1" ;;
  *.bz2) bunzip2 "$1" ;;
  *.rar) unrar x -ad "$1" ;;
  *.gz) gunzip "$1" ;;
  *.tar) tar xvf "$1" ;;
  *.tbz2) tar xvjf "$1" ;;
  *.tgz) tar xvzf "$1" ;;
  *.zip) unzip "$1" ;;
  *.Z) uncompress "$1" ;;
  *.7z) 7z x "$1" ;;
  *.xz) unxz "$1" ;;
  *.exe) cabextract "$1" ;;
  *.deb) pkg unpack "$1" ;;
  *.rpm) pkg unpack "$1" ;;
  *.pet) pkg unpack "$1" ;;
  *.sfs) unsquashfs "$1" ;;
  *) echo "extract: '$1' - unknown archive type" >&2; return 1 ;;
esac

exit $?
User avatar
wiak
Posts: 4079
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 65 times
Been thanked: 1206 times
Contact:

Re: Automated compiling & packaging, using Arch Linux build scripts

Post by wiak »

sc0ttman wrote: Mon Nov 23, 2020 7:39 pm

## pkgbuild2pet

I made two scripts that can be used to compile PET packages from Arch Linux build scripts,
called a "PKGBUILD" :thumbup:

Truly excellent idea. I had never used Arch until I created a WeeDogLinux Arch64 version (which, not knowing Arch, was quite a task for me). However, I came to really appreciate Arch for how current its packages are due its rolling release schedule, but not only current, but impressively well-tested (which would otherwise have been my worry). Good to know such packages available to Puppy via these PKGBUILDs (I presume those from AUR could be used too?).

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
BarryK
Posts: 2676
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 130 times
Been thanked: 735 times

Re: Automated compiling & packaging, using Arch Linux build scripts

Post by BarryK »

sc0ttman,
You do some really interesting things!

Only a few days ago I was looking at an Arch build script and thought it would be nice if we could automate using them for creating PETs -- and now I see you have done it!

User avatar
rockedge
Site Admin
Posts: 6532
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2745 times
Been thanked: 2619 times
Contact:

Re: Automated compiling & packaging, using Arch Linux build scripts

Post by rockedge »

@sc0ttman

I am going full speed into trying out the scripts! I am big fan and a regular user of Pkg and also running some of wiak's WeeDog64-Arch OS builds and various stages of Archpup's so I have delved into using the Arch collection of build scripts.
I also experiment with Void Linux's xbps-src which also builds packages from recipes.

User avatar
rockedge
Site Admin
Posts: 6532
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2745 times
Been thanked: 2619 times
Contact:

Re: Automated compiling & packaging, using Arch Linux build scripts

Post by rockedge »

@sc0ttman
To just get started I tried for the first run:

Code: Select all

 ./arch-pkgbuild-download zoneminder
 ./arch-pkgbuild-compile zoneminder

to get a feel for it and without any expectation that it would first, even be in the recipe repos and secondly, if it is, that the build would complete successfully.

So I go make some tea and when I got back there was a finished PET.

So I have made it available at :https://rockedge.org/kernels/

The PET file is under PET->experimental->zoneminder

For it to actually work there needs to be a LAMP or LHMP.

It would be great if some one could test this zoneminder PET and see what happens. Maybe with a LHMP (or LAMP) installed and running, this zoneminder PET could be converted into a SFS!

I'll have to setup a fresh Fossapup64 as well and see if I can get ZM running from this PET.

All interesting stuff.

User avatar
sc0ttman
Posts: 93
Joined: Sat Aug 22, 2020 3:55 pm
Has thanked: 4 times
Been thanked: 33 times

Re: Automated compiling & packaging, using Arch Linux build scripts

Post by sc0ttman »

I've done a few updates to this, will post them soon ish..

  • strip the binaries before making the PET
  • don't automatically get the "-git" version if normal version not found
  • the above change makes the pkgbuild2pet more reliable

...I also played around with downloading and building the "make depends" automatically, but it's
not worth it - because of too many "Package not found in any repos" to be of much use..

I suspect to fix that, we need to combine these scripts with another one which would search for
and download the Arch Linux binary packages, which are likely to match the names these
scripts search for.

User avatar
BarryK
Posts: 2676
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 130 times
Been thanked: 735 times

Re: Automated compiling & packaging, using Arch Linux build scripts

Post by BarryK »

sc0ttman wrote: Thu Nov 26, 2020 10:32 pm

I suspect to fix that, we need to combine these scripts with another one which would search for
and download the Arch Linux binary packages, which _are_ likely to match the names these
scripts search for.

The ppm looks up the variables $PKG_NAME_ALIASES and $PKG_NAME_IGNORE, to try and resolve the different naming of various distros.

I presume that Arch would tend to use the original package names, unlike Debian which splits packages up into many smaller packages and gives them different names.

However, in the case of Debian and Ubuntu, you can find the "generic" name for a package, that is, it's name before being split up. Here is an example Puppy specs entry:

cups-common_2.2.10-6+deb10u3|cups-common|2.2.10-6+deb10u3||BuildingBlock|3358K|pool/main/c/cups|cups-common_2.2.10-6+deb10u3_all.deb||Common UNIX Printing Systemtm - common files|debian|buster||

...the generic name is "cups", see pool/main/c/cups. Slackware is one example that keeps the packages together, with the original name "cups".

I don't know if Arch does the same, keeps the packages together, but assuming it does, if a package has a dependency "cups", then if you are running a Debian/Ubuntu-based Puppy, do a search in the /root/.packages/Packages-debian-* for all packages with string "/cups|".

Just some thoughts.

Post Reply

Return to “Compiling”