You are not logged in.
In package(), I run make as follows:
make PREFIX="$pkgdir/usr" install
The install target of this make script (not mine) creates a symlink from /usr/share/foo/bin/foo to /usr/bin/:
ln -sf ${PREFIX}/share/foo/bin/foo ${PREFIX}/bin/
When I run makepkg -i, I get a symlink at /usr/bin/foo that points to something in $pkgdir which is somewhere in ~ in my test case.
This is obviously not what I wanted. It should point to /usr/share/foo/bin/foo.
I was a bit surprised to see that makepkg does not do anything special with symlinks. I thought it's obvious that $pkgdir needs to be replaced with / in all symlinks in the .tar.zst file. I'm not sure why it does not do this.
What is the idiomatic solution for this kind of situation?
The easiest solution that comes to mind would be to apply a patch to the makefile so that the ln line above reads:
ln -sf /usr/share/foo/bin/foo ${PREFIX}/bin/
This feels a bit hacky so I was wondering if there's a nicer solution.
Offline
This is why there's often a DESTDIR variable, separate from PREFIX to use for packaging. having $pkgdir in PREFIX is rarily correct.
Offline