[PATCH] Support DESTDIR for make install

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Support DESTDIR for make install

Torsten Landschoff
Hello again,

The attached patch adds support for the DESTDIR variable when using make
install.

This feature is very useful for building distribution packages as you
don't usually install files directly into the running system but instead
into a staging area (like debian/tmp) and create the package from the
contents of that folder.

Greetings, Torsten

--
Torsten Landschoff | Embedded software and FPGA development
nAmbition GmbH     | Tatzberg 47, 01307 Dresden
                   | HRB NR. 23095 b. Amtsgericht Dresden
Managing director  | Frank Pelzer


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general

destdir.patch (34K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Support DESTDIR for make install

Nico Stuurman-4
Hi Torsten,

> The attached patch adds support for the DESTDIR variable when using  
> make
> install.

Thanks for the patch.  Makes total sense.

Only problem I have is that I can not apply the patch:

patch -p2 --verbose destdir.patch

just hangs (no output) until killed.  This is with patch version  
2.5.8.  Could you send me some guidance on how to apply the patch (can  
be off-list)?

Thanks!

Nico


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Support DESTDIR for make install

Torsten Landschoff
Hi Nico,

On Wed, 2009-09-02 at 15:42 -0700, Nico Stuurman wrote:

> > The attached patch adds support for the DESTDIR variable when using  
> > make
> > install.
>
> Thanks for the patch.  Makes total sense.
>
> Only problem I have is that I can not apply the patch:
>
> patch -p2 --verbose destdir.patch
>
> just hangs (no output) until killed.  This is with patch version  
> 2.5.8.  Could you send me some guidance on how to apply the patch (can  
> be off-list)?

patch invocation is a bitch, I stopped noticing after getting used to
it.

Basically, the only sensible way to use the patch utility is with
redirecting stdin from the patch file. The usual convention of
distributed patches is that they can be applied using just

  patch -p1 < destdir.patch

Normally you run this from the top level directory of the source package
in question.


Passing the name of the patch file as an argument in fact tells patch
which file you want to patch, and it still expects the changes to make
on stdin - which is why it hangs in your case.

Greetings, Torsten

--
Torsten Landschoff | Embedded software and FPGA development
nAmbition GmbH     | Tatzberg 47, 01307 Dresden
                   | HRB NR. 23095 b. Amtsgericht Dresden
Managing director  | Frank Pelzer



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Support DESTDIR for make install

Nico Stuurman-4
Hi Torsten,

The attached patch adds support for the DESTDIR variable when using  
make
install.

Thanks for the patch.  Makes total sense.

 patch -p1 < destdir.patch

Thanks!  I missed the redirect in man patch!

Only problem I now ran into is that you double most of the install lines in the DeviceAdapters, for instance:

 install:
- cp .libs/libmmgr_dal_ASIFW1000.so $(DEVICEADAPTERPATH)/libmmgr_dal_ASIFW1000$(MMSUFFIX)
+ cp .libs/libmmgr_dal_ASIFW1000.so $(DESTDIR)$(DEVICEADAPTERPATH)/libmmgr_dal_ASIFW1000$(MMSUFFIX)
+ cp .libs/libmmgr_dal_ASIFW1000.so $(DESTDIR)$(DEVICEADAPTERPATH)/libmmgr_dal_ASIFW1000$(MMSUFFIX)

Manually removing the duplicate lines from the patch file created errors.  Is it easy for you to get rid of these duplicate lines?

Best,

Nico



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Support DESTDIR for make install

Torsten Landschoff
Hi Nico,

On Thu, 2009-09-03 at 13:57 -0700, Nico Stuurman wrote:

> Only problem I now ran into is that you double most of the install
> lines in the DeviceAdapters, for instance:
>
>
>  install:
> - cp .libs/libmmgr_dal_ASIFW1000.so
> $(DEVICEADAPTERPATH)/libmmgr_dal_ASIFW1000$(MMSUFFIX)
> + cp .libs/libmmgr_dal_ASIFW1000.so
> $(DESTDIR)$(DEVICEADAPTERPATH)/libmmgr_dal_ASIFW1000$(MMSUFFIX)
> + cp .libs/libmmgr_dal_ASIFW1000.so
> $(DESTDIR)$(DEVICEADAPTERPATH)/libmmgr_dal_ASIFW1000$(MMSUFFIX)
Ouch, that's what happens if one tests a sed command with "-n /.../p" to
print only the matches. It seems like each changed line was output
twice. Sorry about that and thanks for spotting!

I was too lazy to update the patch manually, using perl it was only a
small deal:

-----
use File::Find ();
use IO::File;

sub fix_am_files() {
    return unless m|/Makefile\.am$|;
    print STDERR "Fixing $_...\n";

    my $in = new IO::File($_);
    my @lines = $in->getlines;
    $in->close;

    my $out = new IO::File($_, "w");
    my $prev = "";
    for (@lines) {
        $out->print($_) unless m/DESTDIR/ && $_ eq $prev;
        $prev = $_;
    }
    $out->close;
}

File::Find::find({wanted => \&fix_am_files, no_chdir => 1}, '.');
-----

The corrected patch is attached (I was lazy and used the output of git format-patch this time).

Greetings, Torsten

--
Torsten Landschoff | Embedded software and FPGA development
nAmbition GmbH     | Tatzberg 47, 01307 Dresden
                   | HRB NR. 23095 b. Amtsgericht Dresden
Managing director  | Frank Pelzer


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general

0001-Updated-DESTDIR-patch.patch (33K) Download Attachment