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

Make install prefix #2

Open
XDjackieXD opened this issue Jan 5, 2021 · 2 comments
Open

Make install prefix #2

XDjackieXD opened this issue Jan 5, 2021 · 2 comments

Comments

@XDjackieXD
Copy link

XDjackieXD commented Jan 5, 2021

Hi!

The install path for the adjtimex binary is hardcoded to /sbin in the Makefile which breaks compatibility with any build system that doesn't use fakeroot for installation (for example buildroot or openwrt).
I worked around this by patching the Makefile.in to honor the exec-prefix as it was in earlier versions.

In addition honoring the variable DESTDIR when running make install would be nice as this is how most buildsystems that come with autotool helpers try to set the install directory (which should be prepended before the set prefix or exec_prefix).
This would give the most flexibility

- Jakob

@XDjackieXD
Copy link
Author

This is the patch I had to apply to compile the package in a buildroot environment

--- a/Makefile.in	2018-07-25 19:02:11.000000000 +0200
+++ b/Makefile.in	2021-01-05 15:51:37.129518976 +0100
@@ -4,6 +4,7 @@
 
 VERSION=1.29
 
+CC = @CC@
 CFLAGS = @CFLAGS@ -Wall
 prefix = @prefix@
 man1dir=@mandir@/man1
@@ -42,13 +43,13 @@
 	$(CC) $(CFLAGS) -c mat.c
 
 install: all
-	$(INSTALL) -g bin -m 755 -o root adjtimex $(bindir)/adjtimex
-	$(INSTALL) -d -g root -m 755 -o root $(mandir)
-	-$(INSTALL) -g root -m 644 -o root $(srcdir)/adjtimex.8 \
-		$(mandir)/adjtimex.$(manext)
+	$(INSTALL) -m 755 adjtimex $(DESTDIR)$(bindir)/adjtimex
+	$(INSTALL) -d -m 755 $(DESTDIR)$(mandir)
+	-$(INSTALL) -m 644 $(srcdir)/adjtimex.8 \
+		$(DESTDIR)$(mandir)/adjtimex.$(manext)
 
 uninstall:
-	rm -f $(bindir)/adjtimex $(mandir)/adjtimex.$(manext)
+	rm -f $(DESTDIR)$(bindir)/adjtimex $(DESTDIR)$(mandir)/adjtimex.$(manext)
 
 clean: 
 	rm -f core *.o

@rogers0
Copy link
Owner

rogers0 commented Apr 29, 2021

@XDjackieXD

Thanks for your report!

I'm wondering whether you checked the patches under debian folder, especially those listed below:

  • debian/patches/01-makefile.in-ldflags.diff
  • debian/patches/08-FTCBFS-uses-the-build-architecture-compiler.patch

So the first part of your patch to amend "CC" was already there.
And installation destination is actually set by "$prefix".
For debian, $prefix is not set, and final location is decided by path in debian/adjtimex.install.
For system like openwrt, I think you can use ./configure --prefix=/usr to update the $prefix variable.

FYI. This git repo is for debian packaging, not for adjtimex upstream.
(however, upstream seems not to be active now...)

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

2 participants