Re: [PATCH] v4l-dvb: add $DESTDIR support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Trent Piepho wrote:
> > Following patch adds $DESTDIR support so one can install the kernel
> > modules into a directory other than / as non-root user. That's
> > useful when building an rpm or compiling for a different machine.
> >
> > Signed-off-by: Ludwig Nussel <ludwig.nussel@xxxxxxx>
> >
> > diff -r 44676649301d v4l/scripts/make_makefile.pl
> > --- a/v4l/scripts/make_makefile.pl	Tue Mar 06 19:15:19 2007 +0100
> > +++ b/v4l/scripts/make_makefile.pl	Wed Mar 07 14:35:40 2007 +0100
> > @@ -134,12 +134,12 @@ print OUT "\t\@strip --strip-debug \$(in
> >
> >  while (my ($dir, $files) = each %instdir) {
> >  	print OUT "\t\@echo -e \"\\nInstalling \$(KDIR26)/$dir files:\"\n";
> > -	print OUT "\t\@install -d \$(KDIR26)/$dir\n";
> > +	print OUT "\t\@install -d \$(DESTDIR)\$(KDIR26)/$dir\n";
> >  	print OUT "\t\@for i in ", join(' ', keys %$files), ";do ";
> >  	print OUT "if [ -e \"\$\$i\" ]; then echo -n \"\$\$i \";";
> > -	print OUT " install -m 644 -c \$\$i \$(KDIR26)/$dir; fi; done; echo;\n\n";
> > +	print OUT " install -m 644 -c \$\$i \$(DESTDIR)\$(KDIR26)/$dir; fi; done; echo;\n\n";
> >  }
> 
> This part looks ok.
> 
> > -print OUT "\t/sbin/depmod -a \${KERNELRELEASE}\n\n";
> > +print OUT "\tif [ -w / ]; then /sbin/depmod -a \${KERNELRELEASE}; fi\n\n";
> 
> This doesn't seem correct.  Shouldn't it be:
> print OUT "\t/sbin/depmod -a \$(KERNELRELEASE) \$(if \$(DESTDIR),-b \$(DESTDIR))\n\n";

One needs to run depmod when the modules get installed to their final location.
$DESTDIR is incomplete so it doesn't make sense to run depmod here already.

> >  # Creating Remove rule
> >  print OUT "media-rminstall::\n";
> 
> Seems like the rminstall rule should use DESTDIR too.

It's not that useful there as you can just rm -rf $DESTDIR. Anyways here's a
patch that includes rminstall:

diff -r f71d56dfeb0d v4l/scripts/make_makefile.pl
--- a/v4l/scripts/make_makefile.pl	Wed Mar 07 12:28:33 2007 -0200
+++ b/v4l/scripts/make_makefile.pl	Thu Mar 08 08:59:11 2007 +0100
@@ -134,12 +134,12 @@ print OUT "\t\@strip --strip-debug \$(in
 
 while (my ($dir, $files) = each %instdir) {
 	print OUT "\t\@echo -e \"\\nInstalling \$(KDIR26)/$dir files:\"\n";
-	print OUT "\t\@install -d \$(KDIR26)/$dir\n";
+	print OUT "\t\@install -d \$(DESTDIR)\$(KDIR26)/$dir\n";
 	print OUT "\t\@for i in ", join(' ', keys %$files), ";do ";
 	print OUT "if [ -e \"\$\$i\" ]; then echo -n \"\$\$i \";";
-	print OUT " install -m 644 -c \$\$i \$(KDIR26)/$dir; fi; done; echo;\n\n";
+	print OUT " install -m 644 -c \$\$i \$(DESTDIR)\$(KDIR26)/$dir; fi; done; echo;\n\n";
 }
-print OUT "\t/sbin/depmod -a \${KERNELRELEASE}\n\n";
+print OUT "\tif [ -w / ]; then /sbin/depmod -a \${KERNELRELEASE}; fi\n\n";
 
 # Creating Remove rule
 print OUT "media-rminstall::\n";
@@ -149,13 +149,13 @@ while ( my ($dir, $files) = each(%instdi
 	print OUT "\t\@echo -e \"\\nRemoving old \$(KDIR26)/$dir files:\"\n";
 	print OUT "\t\@files='", join(' ', keys %$files), "'; ";
 
-	print OUT "for i in \$\$files;do if [ -e \$(KDIR26)/$dir/\$\$i ]; then ";
+	print OUT "for i in \$\$files;do if [ -e \$(DESTDIR)\$(KDIR26)/$dir/\$\$i ]; then ";
 	print OUT "echo -n \"\$\$i \";";
-	print OUT " rm \$(KDIR26)/$dir/\$\$i; fi; done; ";
+	print OUT " rm \$(DESTDIR)\$(KDIR26)/$dir/\$\$i; fi; done; ";
 
-	print OUT "for i in \$\$files;do if [ -e \$(KDIR26)/$dir/\$\$i.gz ]; then ";
+	print OUT "for i in \$\$files;do if [ -e \$(DESTDIR)\$(KDIR26)/$dir/\$\$i.gz ]; then ";
 	print OUT "echo -n \"\$\$i.gz \";";
-	print OUT " rm \$(KDIR26)/$dir/\$\$i.gz; fi; done; echo;\n\n";
+	print OUT " rm \$(DESTDIR)\$(KDIR26)/$dir/\$\$i.gz; fi; done; echo;\n\n";
 }
 
 # Print dependencies of Makefile.media

cu
Ludwig

-- 
 (o_   Ludwig Nussel
 //\   SUSE Labs
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)


_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux