Skip to contentSkip to conversation

fix install/uninstall paths for cross compilation

PATCH In review Aras Vaichas 2 participants 5 messages Oct 26, 2005 – Oct 31, 2005 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix install/uninstall paths for cross compilation

This patch fixes some problems with installing EXTRAS and uninstalling binaries and man pages when DESTDIR has been set e.g. for cross compilation, or creating an initrd

regards,

Aras Vaichas

Makefile 2005-10-26 15:21:35.000000000 +1000 renamed from Makefile.orig 2005-10-26 13:49:47.000000000 +1000 +24 -14
@@ -123,7 +123,7 @@
  sbindir =      ${exec_prefix}/sbin
  usrbindir =    ${exec_prefix}/usr/bin
  usrsbindir =   ${exec_prefix}/usr/sbin
-mandir =       ${prefix}/usr/share/man
+mandir =       ${DESTDIR}/usr/share/man
  configdir =    ${etcdir}/udev
  udevdir =      /dev
  udevdb =       ${udevdir}/.udevdb
@@ -390,31 +390,41 @@
         $(INSTALL_PROGRAM) -D udevstart $(DESTDIR)$(sbindir)/udevstart
         @extras="$(EXTRAS)"; for target in $$extras; do \
                 echo $$target; \
-               $(MAKE) prefix=$(prefix) -C $$target $@; \
+               $(MAKE) DESTDIR=$(DESTDIR) prefix=$(prefix) -C $$target $@; \
         done;
  ifndef DESTDIR
         - killall udevd
         - rm -rf $(udevdb)
         - $(sbindir)/udevd --daemon
+else
+       @echo; \
+       echo "You will have to manually restart udevd on the target"; \
+       echo
  endif
  .PHONY: install-bin
 
  uninstall-bin:
-       - rm -f $(sbindir)/udev
-       - rm -f $(sbindir)/udevd
-       - rm -f $(sbindir)/udevsend
-       - rm -f $(sbindir)/udevinitsend
-       - rm -f $(sbindir)/udeveventrecoreder
-       - rm -f $(sbindir)/udevcontrol
-       - rm -f $(sbindir)/udevstart
-       - rm -f $(usrsbindir)/udevmonitor
-       - rm -f $(usrbindir)/udevinfo
-       - rm -f $(usrbindir)/udevtest
-       - rm -rf $(udevdb)
+       - rm -f $(DESTDIR)$(sbindir)/udev
+       - rm -f $(DESTDIR)$(sbindir)/udevd
+       - rm -f $(DESTDIR)$(sbindir)/udevsend
+       - rm -f $(DESTDIR)$(sbindir)/udevinitsend
+       - rm -f $(DESTDIR)$(sbindir)/udeveventrecoreder
+       - rm -f $(DESTDIR)$(sbindir)/udevcontrol
+       - rm -f $(DESTDIR)$(sbindir)/udevstart
+       - rm -f $(DESTDIR)$(usrsbindir)/udevmonitor
+       - rm -f $(DESTDIR)$(usrbindir)/udevinfo
+       - rm -f $(DESTDIR)$(usrbindir)/udevtest
+       - rm -rf $(DESTDIR)$(udevdb)
+ifndef DESTDIR
         - killall udevd
+else
+       @echo; \
+       echo "You will have to manually stop udevd on the target"; \
+       echo
+endif
         @extras="$(EXTRAS)"; for target in $$extras; do \
                 echo $$target; \
-               $(MAKE) prefix=$(prefix) -C $$target $@; \
+               $(MAKE) DESTDIR=$(DESTDIR) prefix=$(prefix) -C $$target $@; \
         done;
  .PHONY: uninstall-bin
 

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information
_______________________________________________
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 3 lines · Aras Vaichas

This patch fixes some problems with installing EXTRAS and uninstalling binaries and man pages when DESTDIR has been set e.g. for cross compilation, or creating an initrd

Commandline options to make are automatically passed to the submakes, no need to list them explicitly.

DESTDIR is for packaging. What would a "uninstall" be good for?

Kay

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information
_______________________________________________
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 Aras Vaichas
Quoted 9 lines · Kay Sievers
Quoted 3 lines · Aras Vaichas

This patch fixes some problems with installing EXTRAS and uninstalling binaries and man pages when DESTDIR has been set e.g. for cross compilation, or creating an initrd

Commandline options to make are automatically passed to the submakes, no need to list them explicitly.

Can you confirm this by echoing DESTDIR in, say, extras/run_directory/Makefile?

This gave me an empty string unless I explicitly passed it to the submake. Did I make a mistake somewhere?

Quoted 1 line

DESTDIR is for packaging. What would a "uninstall" be good for?

To remove the man pages from an embedded Linux target which has no use for man pages, or to remove an old version of udev from an nfsroot "live" filing system. Considering that udev is in such active development, this will happen frequently.

It's common for me to do something like "make install" and then follow with a "make uninstall-man" or similar because it's easier during the development of a package or live filing system.

But I understand your point - "why would one delete files from a package that is to be shipped to somewhere else?" Yes?

Regardless, without my patch this Makefile was potentially fatal to the host system. When I ran "make install", it installed the binaries and man pages to the correct destination. e.g. /DESTDIR/sbin/ ... but when I ran "make uninstall-bin" it deleted the binaries from /sbin !

"uninstall" should remove the files from where "install" put them.

regards,

Aras Vaichas

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information
_______________________________________________
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 Aras Vaichas
Quoted 8 lines · Aras Vaichas
Quoted 7 lines · Kay Sievers
Quoted 3 lines · Aras Vaichas

This patch fixes some problems with installing EXTRAS and uninstalling binaries and man pages when DESTDIR has been set e.g. for cross compilation, or creating an initrd

Quoted 5 lines
Quoted 2 lines

Commandline options to make are automatically passed to the submakes, no need to list them explicitly.

Can you confirm this by echoing DESTDIR in, say,
extras/run_directory/Makefile?

What do you mean with "echoing"? Sure, passing it the usual way to make works, otherwise the package building which installs everything in a temp directory to pack it into an archive wouldn't work.

make DESTDIR=x EXTRAS=extras/volume_id install extras/volume_id
make[1]: Entering directory `/home/kay/src/udev/extras/volume_id' /usr/bin/install -c vol_id x/sbin/vol_id

Quoted 2 lines

This gave me an empty string unless I explicitly passed it to the submake. Did I make a mistake somewhere?

That should work from the main Makefile, all other values are passed that way too.

Quoted 14 lines
Quoted 1 line

DESTDIR is for packaging. What would a "uninstall" be good for?

To remove the man pages from an embedded Linux target which has no use for man pages, or to remove an old version of udev from an nfsroot "live" filing system. Considering that udev is in such active development, this will happen frequently.

It's common for me to do something like "make install" and then follow with a "make uninstall-man" or similar because it's easier during the development of a package or live filing system.

But I understand your point - "why would one delete files from a package that is to be shipped to somewhere else?" Yes?

Quoted 6 lines

Regardless, without my patch this Makefile was potentially fatal to the host system. When I ran "make install", it installed the binaries and man pages to the correct destination. e.g. /DESTDIR/sbin/ ... but when I ran "make uninstall-bin" it deleted the binaries from /sbin !

"uninstall" should remove the files from where "install" put them.

Ok, I've added the DESTDIR to the uninstall target. :)

Thanks,
Kay

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information
_______________________________________________
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 Aras Vaichas
Quoted 12 lines · Kay Sievers
Quoted 10 lines · Aras Vaichas
Quoted 8 lines · Kay Sievers
Quoted 3 lines · Aras Vaichas

This patch fixes some problems with installing EXTRAS and uninstalling binaries and man pages when DESTDIR has been set e.g. for cross compilation, or creating an initrd

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Commandline options to make are automatically passed to the submakes, no need to list them explicitly.

Can you confirm this by echoing DESTDIR in, say,
extras/run_directory/Makefile?

What do you mean with "echoing"? Sure, passing it the usual way to make

Sorry, I was being a bit lazy with my language! What I meant was to use echo as a debug statement in extras/*/Makefile to see if DESTDIR was actually being passed.

e.g. in extras/run_directory/Makefile

install-bin: all
+ @echo DESTDIR = $(DESTDIR)

         $(INSTALL_PROGRAM) udev_run_devd $(DESTDIR)$(sbindir)/udev_run_devd

The main Makefile explicitly passes "prefix" to the submake, so doesn't DESTDIR have to be passed as well? If I don't pass it, it doesn't get set.

Quoted 3 lines
Quoted 1 line

"uninstall" should remove the files from where "install" put them.

Ok, I've added the DESTDIR to the uninstall target. :)

Thanks!

regards,

Aras Vaichas

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel