Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting Environment Variables Inside Chroot #85

Closed
Mushoz opened this issue Dec 4, 2023 · 5 comments
Closed

Setting Environment Variables Inside Chroot #85

Mushoz opened this issue Dec 4, 2023 · 5 comments

Comments

@Mushoz
Copy link

Mushoz commented Dec 4, 2023

I am trying to build mesa-git: https://aur.archlinux.org/packages/mesa-git

However, this makepkg file requires you to set a MESA_WHICH_LLVM environment variable to select which LLVM version to build against. Option 1 is recommend, but option 4 is the default. If I use MESA_WHICH_LLVM=1 ccm s to build the package, it looks like it's still using the LLVM from the extra repo and ignoring the environment variable. How should I properly set this variable?

@graysky2
Copy link
Owner

graysky2 commented Dec 5, 2023

Test:

  1. Modify the PKGBUILD to simply echo $MESA_WHICH_LLVM (right under the case statement before pkgver's function
  2. Run MESA_WHICH_LLVM=1 makepkg -sd which for me returns a value of 1
  3. Run the same calling MESA_WHICH_LLVM=1 makechrootpkg -r /scratch/.buildroot -- -A --nocheck which for me returns a value of 4 which is the PKGBUILD default

Conclusion: I do not think that makechrootpkg supports prefixed flags.

One work around is to hardcode your value into the PKGBUILD but that is not very elegant. You might consider asking in the Arch forums. I would keep your post simple by not mentioning ccm since this is clearly a makechrootpkg thing.

@LW-archlinux
Copy link

LW-archlinux commented Mar 17, 2024

Passing environment variables to an arbitrary porgram is possible if its started through sudo .

https://wiki.archlinux.org/title/Sudo#Environment_variables

@graysky2 : maybe you could test to verify that method works with ccm -and add something to the docs ?

Thanks for a great tool.

@graysky2
Copy link
Owner

Please try it and report back.

@LW-archlinux
Copy link

I tried but was unable to get things working .
makechrootpkg does seem use to that method , but is hardcoded to only do it for specific env vars.

@graysky2
Copy link
Owner

graysky2 commented Oct 8, 2024

I am closing thinking this is not possible. Not ccm's fault, see above.

@graysky2 graysky2 closed this as completed Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants