Closed hiimdoublej closed 3 years ago
Thanks for your suggestion. But I don't use Arch Linux in a daily base, could you share a tutorial with me on how to create a AUR build and how to test it?
Would a Snapcraft build make your life easier? If it is, I can set up one.
@suzaku @hiimdoublej - I took a stab at one: https://aur.archlinux.org/packages/shonenjump/
I am not very experienced with go
for builds so I do not know if my invocation is correct. Further, namcap
is complaining about my LDFLAGS:
% namcap shonenjump-0.7.20-1-x86_64.pkg.tar.zst
shonenjump W: ELF file ('usr/bin/shonenjump') lacks FULL RELRO, check LDFLAGS.
Thoughts?
@graysky2 Thanks very much.
I'm not familiar with AUR, where can I see your configuration? I can try my best to figure out what might be wrong there.
https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=shonenjump
The go
command is on line 18 as you see.
Do we have to use -v -buildmode=pie -ldflags "-extldflags \"$LDFLAGS\""
when building a Go binary for AUR?
I only use go build .
when building in my development environment.
@suzaku - I get warnings from the distro package audit util if I do not:
% namcap shonenjump-0.7.20-2-x86_64.pkg.tar.zst
shonenjump W: ELF file ('usr/bin/shonenjump') lacks FULL RELRO, check LDFLAGS.
shonenjump W: ELF file ('usr/bin/shonenjump') lacks PIE.
I also think my -ldflags ...
part might be wrong.
Can you try something like go build -v -ldflags "-buildmode=pie"
?
I see a similar configuration here
That syntax seems fine for the PIE warning but it does not fix up the FULL RELRO one.
export CGO_LDFLAGS="$LDFLAGS"
go build -v -ldflags "-buildmode=pie"
Do I have to tell go
to use the newly defined variable or is that implied?
How about this go build -buildmode=pie -ldflags '-linkmode=external -extldflags=-Wl,-z,relro,-z,now'
? (ref)
That did it, thanks.
go build -buildmode=pie -ldflags "-linkmode=external -extldflags=$LDFLAGS"
No warnings from namcap
on the resulting package.
You might wanna edit your README to point Arch Linux users to the AUR package.
Does the j
command work now in your environment? You can try cd
around and then run j -stat
and j -purge
.
Yes, it works. Tested under zsh and bash.
Cool, thanks very much!
I'm not familiar with AUR, could you please add a AUR
subsection under the Linux
section?
Thanks. I can close this issue now. @hiimdoublej
The AUR (Arch User Repository) is just a place where Arch Linux users can submit an Arch-specific PKGBUILD
for software. It's like a gentoo ebuild.
I see. Is there a command like apt install
for AUR
?
No, the AUR does not store binary packages. It stores the recipe for users to build them. That is the PKGBUILD
which keeps track of dependencies, and along with the Arch-specific build tool makepkg
builds the binary package.
Good to learn that, thanks.
The advantage of using the PKGBUILD method is that it produces a package for use with the distro package manager, pacman
so that all files are tracked and easily updated/removed. A bit more sophisticated vs downloading and placing files manually :wink:
How can I post new versions of this package on AUR? Ideally, I should integrate it into the build pipeline.
You can take over the PKGBUILD if you want to maintain it. It's just git. Not sure how to do any integration though.
I use goreleaser
to push updates to my Homebrew
tap, but AUR
is not supported, so I guess I have to do the same manually.
It's up to you. Alternatively, I can continue to maintain it. When you push a new release, just flag it out-of-date. If you want to maintain it, let me know when you have an AUR account and I will disown the package; you can then adopt it and it's all yours.
OK, thank you. Please continue to maintain it now, I guess I'll play with Arch Linux a little bit when I get a new non-Mac laptop.
OK, let me know. If you're using debian/ubuntu, transitioning to Arch is pretty straight forward. I made the switch years ago and haven't looked back. The Arch Way is very appealing to me and the package manager (pacman
) and the build tools are very simple and elegant compared to how other distros do it.
If you want to read up a bit, the Arch wiki is a spectacular resource and the forums are very helpful/really friendly user base.
I'm using macOS now. I have tried Manjaro for a short time before and it looked great.
Be aware that Manjaro is not Arch. It is based on Arch but a different distro.
I see. For me, it's like a newbie-friendly Arch.
That's fine. I believe Arch is more flexible but if you want something more friendly, that is your decision.
As title, an AUR build would make it easier to install for Arch Linux users.