Skip to contentSkip to conversation

DESTDIR for udev

PATCH In review Olaf Hering 3 participants 9 messages Oct 28, 2003 – Oct 29, 2003 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 DESTDIR for udev

For these distro guys.
make install DESTDIR=/tmp/foobar

Makefile +9 -8
@@ -26,6 +26,7 @@
 INSTALL_DIR =	/usr/local/bin
 RELEASE_NAME =	$(ROOT)-$(VERSION)
 
+DESTDIR  # override this to make udev look in a different location for it's config files
 prefix  exec_prefix =	${prefix}
@@ -192,14 +193,14 @@
 
 
 install: all
-	$(INSTALL) -d $(udevdir)
-	$(INSTALL) -d $(configdir)
-	$(INSTALL) -d $(hotplugdir)
-	$(INSTALL_PROGRAM) -D $(ROOT) $(sbindir)/$(ROOT)
-	$(INSTALL_DATA) -D udev.8 $(mandir)/man8/udev.8
-	$(INSTALL_DATA) udev.config $(configdir)
-	$(INSTALL_DATA) udev.permissions $(configdir)
-	- ln -s $(sbindir)/$(ROOT) $(hotplugdir)/udev.hotplug
+	$(INSTALL) -d $(DESTDIR)$(udevdir)
+	$(INSTALL) -d $(DESTDIR)$(configdir)
+	$(INSTALL) -d $(DESTDIR)$(hotplugdir)
+	$(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT)
+	$(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8
+	$(INSTALL_DATA) udev.config $(DESTDIR)$(configdir)
+	$(INSTALL_DATA) udev.permissions $(DESTDIR)$(configdir)
+	- ln -s $(sbindir)/$(ROOT) $(DESTDIR)$(hotplugdir)/udev.hotplug
 
 uninstall:
 	- rm $(hotplugdir)/udev.hotplug
Signature · 14 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#1 lore raw
Quoted 2 lines · Olaf Hering

For these distro guys.
make install DESTDIR=/tmp/foobar

What's wrong with the existing makefile where you can do:
make install prefix=/tmp/foobar

That's what the RPM currently does.

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Olaf Hering
Quoted 8 lines · Greg KH
Quoted 2 lines · Olaf Hering

For these distro guys.
make install DESTDIR=/tmp/foobar

What's wrong with the existing makefile where you can do:
make install prefix=/tmp/foobar

That's what the RPM currently does.

The hotplug symlink looks bogus. DESTDIR is for packaging, not for --prefix.

Signature · 14 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#3 lore raw
In reply to Olaf Hering
Quoted 6 lines · Olaf Hering
Quoted 4 lines · Greg KH
Quoted 2 lines · Olaf Hering

For these distro guys.
make install DESTDIR=/tmp/foobar

Quoted 7 lines
Quoted 4 lines

What's wrong with the existing makefile where you can do:
make install prefix=/tmp/foobar

That's what the RPM currently does.

The hotplug symlink looks bogus. DESTDIR is for packaging, not for --prefix.

This is a more complete patch.
You already noticed the bogus symlink /etc/hotplug.d/default/udev.hotplug

Makefile +9 -8
diff -p -purN udev.bk.orig/Makefile udev.bk/Makefile
@@ -26,6 +26,7 @@ VERSION =	005
 INSTALL_DIR =	/usr/local/bin
 RELEASE_NAME =	$(ROOT)-$(VERSION)
 
+DESTDIR  # override this to make udev look in a different location for it's config files
 prefix  exec_prefix =	${prefix}
@@ -195,14 +196,14 @@ release: $(DISTFILES) clean
 
 
 install: all
-	$(INSTALL) -d $(udevdir)
-	$(INSTALL) -d $(configdir)
-	$(INSTALL) -d $(hotplugdir)
-	$(INSTALL_PROGRAM) -D $(ROOT) $(sbindir)/$(ROOT)
-	$(INSTALL_DATA) -D udev.8 $(mandir)/man8/udev.8
-	$(INSTALL_DATA) udev.config $(configdir)
-	$(INSTALL_DATA) udev.permissions $(configdir)
-	- ln -s $(sbindir)/$(ROOT) $(hotplugdir)/udev.hotplug
+	$(INSTALL) -d $(DESTDIR)$(udevdir)
+	$(INSTALL) -d $(DESTDIR)$(configdir)
+	$(INSTALL) -d $(DESTDIR)$(hotplugdir)
+	$(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT)
+	$(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8
+	$(INSTALL_DATA) udev.config $(DESTDIR)$(configdir)
+	$(INSTALL_DATA) udev.permissions $(DESTDIR)$(configdir)
+	- ln -s $(sbindir)/$(ROOT) $(DESTDIR)$(hotplugdir)/udev.hotplug
 
 uninstall:
 	- rm $(hotplugdir)/udev.hotplug
udev.spec +2 -4
diff -p -purN udev.bk.orig/udev.spec udev.bk/udev.spec
@@ -7,7 +7,7 @@ Group: Utilities/System
 Source: ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/%{name}-%{version}.tar.gz
 ExclusiveOS: Linux
 Vendor: Greg Kroah-Hartman <[email protected]>
-BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 Prereq: /bin/sh, fileutils, hotplug
 
 %description
@@ -21,9 +21,7 @@ udev is a implementation of devfs in use
 make CC="gcc $RPM_OPT_FLAGS"
 
 %install
-make prefix=$RPM_BUILD_ROOT install
-rm -f ${RPM_BUILD_ROOT}/etc/hotplug.d/default/udev.hotplug
-ln -s /sbin/udev ${RPM_BUILD_ROOT}/etc/hotplug.d/default/udev.hotplug
+make DESTDIR=$RPM_BUILD_ROOT install
 
 %clean
 rm -rf $RPM_BUILD_ROOT
Signature · 14 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#4 lore raw
In reply to Olaf Hering
Quoted 8 lines · Olaf Hering
Quoted 6 lines · Olaf Hering
Quoted 4 lines · Greg KH
Quoted 2 lines · Olaf Hering

For these distro guys.
make install DESTDIR=/tmp/foobar

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

What's wrong with the existing makefile where you can do:
make install prefix=/tmp/foobar

That's what the RPM currently does.

The hotplug symlink looks bogus. DESTDIR is for packaging, not for --prefix.

Are these names documented as the default somewhere in the LSB or something like it? What's wrong with using prefix in the rpm file?

Quoted 2 lines

This is a more complete patch.
You already noticed the bogus symlink /etc/hotplug.d/default/udev.hotplug

Why is it bogus? I couldn't get rpm to pick up the symlink any other way. It looks like your patch just gets rid of it alltogether, right? That's not good.

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#5 lore raw
In reply to Olaf Hering
Quoted 20 lines · Greg KH
Quoted 8 lines · Olaf Hering
Quoted 6 lines · Olaf Hering
Quoted 4 lines · Greg KH
Quoted 2 lines · Olaf Hering

For these distro guys.
make install DESTDIR=/tmp/foobar

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

What's wrong with the existing makefile where you can do:
make install prefix=/tmp/foobar

That's what the RPM currently does.

The hotplug symlink looks bogus. DESTDIR is for packaging, not for --prefix.

Are these names documented as the default somewhere in the LSB or something like it? What's wrong with using prefix in the rpm file?

Quoted 6 lines
Quoted 2 lines

This is a more complete patch.
You already noticed the bogus symlink /etc/hotplug.d/default/udev.hotplug

Why is it bogus? I couldn't get rpm to pick up the symlink any other way. It looks like your patch just gets rid of it alltogether, right? That's not good.

How do I explain that to you. Lets try it that way:
pick your current spec file and build the rpm as user. It will not work because you can not write below /etc or /sbin as example.
You use prefix=$RPM_BUILD_ROOT to workaround that fact. The symlink, created in the Makefile will be:
ln -sv /var/tmp/udev-root/sbin/udev /var/tmp/udev-root/etc/hotplug.d/default With my patch it will be
ln -sv /sbin/udev /var/tmp/udev-root/etc/hotplug.d/default

no need to remove it and recreate it manually in the specfile.

DESTDIR= is used in many projects to install the files for packaging in the temporary directory.

Signature · 14 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#6 lore raw
In reply to Olaf Hering
Quoted 38 lines · Olaf Hering
Quoted 20 lines · Greg KH
Quoted 8 lines · Olaf Hering
Quoted 6 lines · Olaf Hering
Quoted 4 lines · Greg KH
Quoted 2 lines · Olaf Hering

For these distro guys.
make install DESTDIR=/tmp/foobar

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

What's wrong with the existing makefile where you can do:
make install prefix=/tmp/foobar

That's what the RPM currently does.

The hotplug symlink looks bogus. DESTDIR is for packaging, not for --prefix.

Are these names documented as the default somewhere in the LSB or something like it? What's wrong with using prefix in the rpm file?

Quoted 6 lines
Quoted 2 lines

This is a more complete patch.
You already noticed the bogus symlink /etc/hotplug.d/default/udev.hotplug

Why is it bogus? I couldn't get rpm to pick up the symlink any other way. It looks like your patch just gets rid of it alltogether, right? That's not good.

How do I explain that to you. Lets try it that way:
pick your current spec file and build the rpm as user. It will not work because you can not write below /etc or /sbin as example.
You use prefix=$RPM_BUILD_ROOT to workaround that fact. The symlink, created in the Makefile will be:
ln -sv /var/tmp/udev-root/sbin/udev /var/tmp/udev-root/etc/hotplug.d/default With my patch it will be
ln -sv /sbin/udev /var/tmp/udev-root/etc/hotplug.d/default

Quoted 1 line

no need to remove it and recreate it manually in the specfile.

Ok, that makes more sense now, thanks.

Quoted 2 lines

DESTDIR= is used in many projects to install the files for packaging in the temporary directory.

Ok, I've applied your last patch for the Makefile and the spec file and tested that it still builds a useful rpm file.

thanks again for the patch,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#7 lore raw
In reply to Olaf Hering
Quoted 7 lines · Greg KH
Quoted 3 lines
Quoted 3 lines

The hotplug symlink looks bogus. DESTDIR is for packaging, not for --prefix.

Are these names documented as the default somewhere in the LSB or something like it? What's wrong with using prefix in the rpm file?

I haven't looked at udev, but generally speaking, --prefix is used to specify where on the filesystem the software will *live*, while DESTDIR is used to specify under which "root" directory the files will be put during a make install.

The key difference is that the --prefix will sometimes be compiled somewhere into the software (as an hardcoded default path to a config file or data directory, for example) while the DESTDIR has no influence on the software.

Typically, --prefix is specified at ./configure time, and is either /usr or /usr/local (usual default), while DESTDIR is only specified at make install time, and can have any value useful to the "make install"er.

I don't know if there is any proper documentation or standard for these features. Both come with almost every software that uses automake/autoconf as part of its build system.

Signature · 13 lines
[email protected] - http://adrien.beau.free.fr/



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#8 lore raw
In reply to Olaf Hering
Quoted 19 lines · Adrien Beau
Quoted 7 lines · Greg KH
Quoted 3 lines
Quoted 3 lines

The hotplug symlink looks bogus. DESTDIR is for packaging, not for --prefix.

Are these names documented as the default somewhere in the LSB or something like it? What's wrong with using prefix in the rpm file?

I haven't looked at udev, but generally speaking, --prefix is used to specify where on the filesystem the software will *live*, while DESTDIR is used to specify under which "root" directory the files will be put during a make install.

The key difference is that the --prefix will sometimes be compiled somewhere into the software (as an hardcoded default path to a config file or data directory, for example) while the DESTDIR has no influence on the software.

Quoted 8 lines

Typically, --prefix is specified at ./configure time, and is either /usr or /usr/local (usual default), while DESTDIR is only specified at make install time, and can have any value useful to the "make install"er.

I don't know if there is any proper documentation or standard for these features. Both come with almost every software that uses automake/autoconf as part of its build system.

Ah, thanks for the explaination. As udev isn't using automake/autoconf (and I don't want it too, either, please don't send patches doing that...) I had to try to remember what the defaults were :)

I've accepted the DESTDIR patch.

thanks again.

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel