You are not logged in.

#1 2021-05-04 07:36:59

DAC324
Member
Registered: 2020-03-12
Posts: 49

Makepkg: Run prepare() without extracting sources

Hello all,

I must admit that I do not fully understand why this topic is of so little interest that Google retrieves forum threads with their last responses dating back to 2017 (and thus, causing complaints about "necrobumping" when trying to reply to them).

The question is: How can you avoid having to extract the source archive of a certain package again and again each time you make a modification to PKGBUILD to, let's say, include or exclude some flags or patches?

The -e option in makepkg skips both source extraction as well as running prepare() from PKGBUILD.

There was one recommendation to just execute prepare() from the command line:

. ./PKGBUILD
prepare

Or, better, sourcing the makepkg config file as well as the srcdir variable:

. /etc/makepkg.conf
. ./PKGBUILD
srcdir=$(readlink -f src)
prepare 

The recommendation was to put that in an alias like this:

alias runprep='. /etc/makepkg.conf && . ./PKGBUILD && srcdir=$(readlink -f src) && prepare'

That, indeed, seems to work to some extent, but I get error messages like

msg2: command not found
check_option: command not found

How can I include such commands like msg2 when running prepare() using the approach proposed above? Or is this impossible if commands like check_option or check_buildoption are used which seem to be makepkg internal commands?

Last edited by DAC324 (2021-05-04 07:50:23)

Offline

#2 2021-05-04 09:10:01

Allan
Member
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,012
Website

Re: Makepkg: Run prepare() without extracting sources

Better question is why are you using makepkg internal options that are not documented and could change or be removed next release?

Offline

#3 2021-05-04 22:43:34

thiagowfx
Member
Registered: 2013-07-09
Posts: 556

Re: Makepkg: Run prepare() without extracting sources

https://wiki.archlinux.org/title/Arch_p … _etiquette:

Do not use makepkg subroutines (e.g. error, msg, msg2, plain, warning) as they might change at any time. To print data, use printf or echo.

Offline

#4 2021-05-05 13:29:23

DAC324
Member
Registered: 2020-03-12
Posts: 49

Re: Makepkg: Run prepare() without extracting sources

Allan wrote:

Better question is why are you using makepkg internal options that are not documented and could change or be removed next release?

I must admit that I did not write the PKGBUILD file by myself.

Thank you very much for pointing out that these internal options shall be avoided. I fully get that point. Problem now is: How can I replace them by something more reliable?

In particular, there are the following internal commands that need to be replaced:

check_option
check_buildoption

msg2 can be successfully replaced by echo so that is not a problem. But with the others, I currently do not have a clue.

Offline

#5 2021-05-05 13:51:52

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 25,241

Re: Makepkg: Run prepare() without extracting sources

If you want help fixing the PKGBUILD, you'll need to show us the PKGBUILD.

Those commands should simply be removed from the PKGBUILD.  If they were doing something important, then we need to know what their intent was.  The only way to fully replicate the exact functions from makepkg would be to use the actual functions from makepkg - but this is definitely not necessary.  So what *is* needed?

EDIT: based on your history - I'd guess this was all about chromium-dev, right?

For the ccache check (on line 531), there may be a better way, but you can just check for the CCACHE environment variables (e.g., CCACHE_PREFIX).  That's only if the check is even needed.  In at least one place (line 457) the check is pointless.  That if block sets a couple CCACHE_* environment variables if ccache is being used.  If it isn't being used, then there should be no harm in setting those variables anyways.  So don't even bother checking, just set the variables.  The check_option used for 'strip' seems equally useless: if strip is set, no symbols are used ... so what?  They'd be stripped anyways.  So this too does nothing.

I'd say toss that whole PKGBUILD and start from scratch.  It's needlessly complex and does a few things that are just silly but harmless, and so I'd bet it also does other things that are silly and potentially harmful (like lines 463-467).

Last edited by Trilby (2021-05-05 14:06:58)


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

Online

#6 2021-05-05 13:52:56

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

Re: Makepkg: Run prepare() without extracting sources

Can you post the PKGBUILD and tell us what you would like to change?

Offline

#7 2021-05-05 14:30:29

DAC324
Member
Registered: 2020-03-12
Posts: 49

Re: Makepkg: Run prepare() without extracting sources

Trilby wrote:

If you want help fixing the PKGBUILD, you'll need to show us the PKGBUILD.

Those commands should simply be removed from the PKGBUILD.  If they were doing something important, then we need to know what their intent was.  The only way to fully replicate the exact functions from makepkg would be to use the actual functions from makepkg - but this is definitely not necessary.  So what *is* needed?

EDIT: based on your history - I'd guess this was all about chromium-dev, right?

For the ccache check (on line 531), there may be a better way, but you can just check for the CCACHE environment variables (e.g., CCACHE_PREFIX).  That's only if the check is even needed.  In at least one place (line 457) the check is pointless.  That if block sets a couple CCACHE_* environment variables if ccache is being used.  If it isn't being used, then there should be no harm in setting those variables anyways.  So don't even bother checking, just set the variables.  The check_option used for 'strip' seems equally useless: if strip is set, no symbols are used ... so what?  They'd be stripped anyways.  So this too does nothing.

I'd say toss that whole PKGBUILD and start from scratch.  It's needlessly complex and does a few things that are just silly but harmless, and so I'd bet it also does other things that are silly and potentially harmful (like lines 463-467).

Indeed, I am playing around a bit with chromium-dev. In order to obtain the latest available version of the sources, I have found https://gsdview.appspot.com/chromium-br … a.tar.x%40 (where you can insert the latest version number available to you, in order to see if there are newer versions available already).

So I inserted these version numbers in chromium-dev's PKGBUILD in order to kind of automate the download and compilation of the latest Chromium developer build.

There are, of course, changes to be made to PKGBUILD from time to time, in order to keep up with the sources, such as inclusion or exclusion of third party components, patches and so on.
For that, it is, of course, not always necessary to extract the source archive freshly. As this takes a considerable amount of time on my old rig, I wanted to avoid that whenever possible.

That's the story, and here's the PKGBUILD I hacked together so far:

https://pastebin.com/pUCxBz6V

Offline

#8 2021-05-05 18:19:19

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 4,052

Re: Makepkg: Run prepare() without extracting sources

So, this is:

  • pointlessly checking for ccache before setting ccache-specific variables

  • pointlessly checking for strip before declining to generate the symbols which would be stripped anyway

  • checking for ccache and sed'ing ccache into the build scripts

  • not using the system clang (why not???)

  • disrespecting MAKEFLAGS from makepkg.conf when building bundled ffmpeg

  • forcing strip off, then manually stripping everything


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#9 2021-05-10 15:56:48

DAC324
Member
Registered: 2020-03-12
Posts: 49

Re: Makepkg: Run prepare() without extracting sources

eschwartz wrote:

So, this is:

  • pointlessly checking for ccache before setting ccache-specific variables

  • pointlessly checking for strip before declining to generate the symbols which would be stripped anyway

  • checking for ccache and sed'ing ccache into the build scripts

  • not using the system clang (why not???)

  • disrespecting MAKEFLAGS from makepkg.conf when building bundled ffmpeg

  • forcing strip off, then manually stripping everything

At least, I made some progress - the reason for not using system clang, llvm-ar, ld and others is that:

  • system clang does not know about plugins   "-Xclang",   "find-bad-constructs",   "-plugin-arg-find-bad-constructs",   "checked-ptr-as-trivial-member".

  • system ld does not know the option '--icf=' in general and '--icf=all' in particular

In order to circumvent this and to not having to patch the sources on each new version, the package maintainers chose to use the bundled buildtools instead of the system ones.

EDIT: At least for the first item, there is 'clang_use_chrome_plugins=false' that makes clang ignore those Chrome plugins.
Now, it looks like I must find out why "use_gold=false' and 'use_lld=false' do not seem to have any effect (options --color-diagnostics, --icf, and --no-call-graph-profile-sort are not recognized by lld).

And, even with the plugins removed, clang++ produces more fun when you try to use the system's version:

In file included from ../../base/check_op.h:11:
../../base/check.h:88:3: error: 'nomerge' attribute cannot be applied to a declaration
  NOMERGE ~CheckError();
  ^       ~
../../base/compiler_specific.h:344:19: note: expanded from macro 'NOMERGE'
#define NOMERGE [[clang::nomerge]]
                  ^
1 error generated.

Looks like using system buildtools, is not a good idea, at least for Chromium sad

Last edited by DAC324 (2021-05-10 19:42:00)

Offline

#10 2021-05-10 18:57:03

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 4,052

Re: Makepkg: Run prepare() without extracting sources

Gosh, I wish the Arch Developer who maintains the "chromium" package in [extra] and uses lld, clang_use_chrome_plugins=false, etc. was as smart as this random AUR user who somehow knows that chromium-dev is "easier" to build using the bundled buildtools...

... assuming by "easier" you mean "make a much bigger PKGBUILD that does all sorts of wild stuff that breaks the recommendation you mentioned in the first post".

How about we all agree the AUR maintainer is doing it wrong and should follow closer to [extra]/chromium? smile


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#11 2021-05-10 19:50:25

DAC324
Member
Registered: 2020-03-12
Posts: 49

Re: Makepkg: Run prepare() without extracting sources

eschwartz wrote:

Gosh, I wish the Arch Developer who maintains the "chromium" package in [extra] and uses lld, clang_use_chrome_plugins=false, etc. was as smart as this random AUR user who somehow knows that chromium-dev is "easier" to build using the bundled buildtools...

... assuming by "easier" you mean "make a much bigger PKGBUILD that does all sorts of wild stuff that breaks the recommendation you mentioned in the first post".

How about we all agree the AUR maintainer is doing it wrong and should follow closer to [extra]/chromium? smile

Thank you very much for your wisdom.

The PKGBUILD I had linked to, was not entirely created by me (apologies if that wasn't clear). I only tried to adapt it to newer versions of the source code.

At least, I was just trying to follow your recommendations but apparently failed.

Plus, the idea for using the bundled buildtools did not come from my end but from the maintainers of chromium-dev, and it looks like they at least had some reasons for their approach.

One reason might be simple:

[gerd@gerd-desktop bin]$ clang --version
clang version 11.1.0
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
[gerd@gerd-desktop bin]$ ./clang --version
clang version 13.0.0 (https://github.com/llvm/llvm-project/ a749bd76394c05b423cd643633188eb09f59fbe8)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/gerd/Downloads/chromium-dev/src/chromium-92.0.4498.0/third_party/llvm-build/Release+Asserts/bin/.

Looks like to compile Chromium (developer versions!) you will have to update clang first. As that is not trivial, the chromium-dev package maintainers tried to avoid it.

Last edited by DAC324 (2021-05-11 07:53:57)

Offline

#12 2021-05-11 11:10:03

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 9,134

Re: Makepkg: Run prepare() without extracting sources

clang version 13.0.0 (https://github.com/llvm/llvm-project/ a749bd76394c05b423cd643633188eb09f59fbe8)

Updating llvm/clang won't be enough.
Last stable release of llvm/clang is 12 , 13 is trunk .
That specific commit was added 27 days ago, so it does look like google uses a snapshot for chromium-dev .

Maybe those aur maintainers could separate building a snapshot of llvm/clang trunk to another package ?

Aur llvm-git & llvm-minimal-git as well as the pkgbuilds in Lordheavy's mesa-git repo could serve as examples how to build llvm/clang trunk versions .

https://aur.archlinux.org/packages/llvm-git/
https://aur.archlinux.org/packages/llvm-minimal-git/
https://gitlab.com/lordheavy/mesa-git/- … r/llvm-git


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
Did you use the guided installer ? If yes, I can't help you.

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

Offline

Board footer

Powered by FluxBB