[PATCH x2] support VPATH / out-of-source-tree builds

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

[PATCH x2] support VPATH / out-of-source-tree builds

Anthony Foiani

Greetings.

Looking through the recent commits, I expect that this will be
rejected for mainline (uses $^ and supports VPATH, both of which are
GNU Make-isms, apparently.  Heaven forbid FreeBSD actually join the
1990s...)

Submitting anyway, in case someone might find it useful later.

These changes build on top of my trivial cross-compile patch, and
allow me to build pcscd and ccid in the common autoconf manner (i.e.,
out of source tree).

Thanks for the excellent base to work from!

Best regards,
Anthony Foiani




------------------------------------------------------------------------------
Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game
on Steam. $5K grand prize plus 10 genre and skill prizes.
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
Opensc-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/opensc-devel

0001-Work-with-document-sources-through-VPATH.patch (1K) Download Attachment
0002-Work-with-generated-source-files-through-VPATH.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH x2] support VPATH / out-of-source-tree builds

Ludovic Rousseau
2013/3/27 Anthony Foiani <[hidden email]>:
> Greetings.

Hello,

> Looking through the recent commits, I expect that this will be
> rejected for mainline (uses $^ and supports VPATH, both of which are
> GNU Make-isms, apparently.  Heaven forbid FreeBSD actually join the
> 1990s...)

I removed the use of $^ just 10 days ago. See [1] and [2].

It does not harm (too much) and allow support of BSD make.

> Submitting anyway, in case someone might find it useful later.
>
> These changes build on top of my trivial cross-compile patch, and
> allow me to build pcscd and ccid in the common autoconf manner (i.e.,
> out of source tree).

Why do you need the second patch?
What fails without the patch?

> Thanks for the excellent base to work from!

You are welcome.

Bye

[1] http://lists.alioth.debian.org/pipermail/pcsclite-cvs-commit/2013-March/006127.html
[2] http://lists.alioth.debian.org/pipermail/pcsclite-cvs-commit/2013-March/006125.html

--
 Dr. Ludovic Rousseau

------------------------------------------------------------------------------
Own the Future-Intel&reg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game
on Steam. $5K grand prize plus 10 genre and skill prizes.
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
Opensc-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH x2] support VPATH / out-of-source-tree builds

Anthony Foiani
Ludovic, greetings --

On Wed, Mar 27, 2013 at 3:54 PM, Ludovic Rousseau
<[hidden email]> wrote:
> I removed the use of $^ just 10 days ago. See [1] and [2].
>
> It does not harm (too much) and allow support of BSD make.

I saw those commits, hence my comments in the original submission.

My question is, without using $^, how can one support VPATH or some
other out-of-source-tree build method?

(It might be possible to use autoconf to sub in the right paths.  I
don't know autoconf & friends well enough to say.)

>
>> Submitting anyway, in case someone might find it useful later.
>>
>> These changes build on top of my trivial cross-compile patch, and
>> allow me to build pcscd and ccid in the common autoconf manner (i.e.,
>> out of source tree).
>
> Why do you need the second patch?

Because some of the headers that pcsc-wirecheck-gen.c relies on are
created by "configure": in an out-of-source-tree build, this means
that pcsc-wirecheck-gen.c lives in the main source tree, but
PCSC/pcsclite.h and pcsc.h live in the build directory.

That is, I end up with this situation:

$ find pcscd-build/src/ pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/ -type f
-name '*.[hc]' | sort

### these are generated files, so they live in the "build" directory
pcscd-build/src/configfile.c
pcscd-build/src/pcscd.h
pcscd-build/src/PCSC/pcsclite.h
pcscd-build/src/tokenparser.c

### these are the files that ship with the distribution,
### so they live in the "original source" directory:
pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/atrhandler.c
pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/atrhandler.h
...
pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/pcscdaemon.c
pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/PCSC/debuglog.h
pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/PCSC/ifdhandler.h
pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/PCSC/reader.h
pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/PCSC/winscard.h
pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/PCSC/wintypes.h
pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/pcsc-wirecheck-dist.c
pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/pcsc-wirecheck-gen.c
pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/pcsc-wirecheck-main.c
...

> What fails without the patch?

The actual "make" invocation is done inside pcscd-build, using VPATH
to find the sources in the main distribution tree.

For the documentation issue, it fails because the .pod file lives in
the source (distribution) tree, not in the build (generated) tree.
GNU Make is smart enough to prepend the necessary bits of VPATH to $^
so that the original source .pod file is found correctly.

In the case of pcsc-wirecheck-gen, it's a bit crazier:

* the actual 'make' process is running in pcscd-build/src
* but it's working on a file in the source tree
(pcsc-lite-.../PCSC/pcsc-wirecheck-gen.c)
* that file includes (directly or indirectly) both distributed and
generated headers, both as "local" includes and <system> includes.

So I had to add all the various places that the compiler has to look
for the headers.

The short answer to "what failes without the patch" is that
out-of-source-tree builds do not complete without these patches (or
something close to them).

Correct answer might very well be: "don't do that".  Fair enough, but
this technique is a very standard way of building packages, especially
autoconf packages; the fact that it failed was an unpleasant surprise.

(And even if you don't care for the rest of the patch, you include two
".in" files on a list of _SOURCES in there somewhere; that should
probably be fixed regardless of the rest of this patch.)

Thanks again.

Best regards,
Anthony Foiani

------------------------------------------------------------------------------
Own the Future-Intel&reg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game
on Steam. $5K grand prize plus 10 genre and skill prizes.
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
Opensc-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH x2] support VPATH / out-of-source-tree builds

Ludovic Rousseau
2013/3/28 Anthony Foiani <[hidden email]>:

> Ludovic, greetings --
>
> On Wed, Mar 27, 2013 at 3:54 PM, Ludovic Rousseau
> <[hidden email]> wrote:
>> I removed the use of $^ just 10 days ago. See [1] and [2].
>>
>> It does not harm (too much) and allow support of BSD make.
>
> I saw those commits, hence my comments in the original submission.
>
> My question is, without using $^, how can one support VPATH or some
> other out-of-source-tree build method?
>
> (It might be possible to use autoconf to sub in the right paths.  I
> don't know autoconf & friends well enough to say.)

Fixed in revision 6579.

>>> Submitting anyway, in case someone might find it useful later.
>>>
>>> These changes build on top of my trivial cross-compile patch, and
>>> allow me to build pcscd and ccid in the common autoconf manner (i.e.,
>>> out of source tree).
>>
>> Why do you need the second patch?
>
> Because some of the headers that pcsc-wirecheck-gen.c relies on are
> created by "configure": in an out-of-source-tree build, this means
> that pcsc-wirecheck-gen.c lives in the main source tree, but
> PCSC/pcsclite.h and pcsc.h live in the build directory.
>
> That is, I end up with this situation:
>
> $ find pcscd-build/src/ pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/ -type f
> -name '*.[hc]' | sort
>
> ### these are generated files, so they live in the "build" directory
> pcscd-build/src/configfile.c
> pcscd-build/src/pcscd.h
> pcscd-build/src/PCSC/pcsclite.h
> pcscd-build/src/tokenparser.c
>
> ### these are the files that ship with the distribution,
> ### so they live in the "original source" directory:
> pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/atrhandler.c
> pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/atrhandler.h
> ...
> pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/pcscdaemon.c
> pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/PCSC/debuglog.h
> pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/PCSC/ifdhandler.h
> pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/PCSC/reader.h
> pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/PCSC/winscard.h
> pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/PCSC/wintypes.h
> pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/pcsc-wirecheck-dist.c
> pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/pcsc-wirecheck-gen.c
> pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/pcsc-wirecheck-main.c
> ...
>
>> What fails without the patch?
>
> The actual "make" invocation is done inside pcscd-build, using VPATH
> to find the sources in the main distribution tree.
>
> For the documentation issue, it fails because the .pod file lives in
> the source (distribution) tree, not in the build (generated) tree.
> GNU Make is smart enough to prepend the necessary bits of VPATH to $^
> so that the original source .pod file is found correctly.
>
> In the case of pcsc-wirecheck-gen, it's a bit crazier:
>
> * the actual 'make' process is running in pcscd-build/src
> * but it's working on a file in the source tree
> (pcsc-lite-.../PCSC/pcsc-wirecheck-gen.c)
> * that file includes (directly or indirectly) both distributed and
> generated headers, both as "local" includes and <system> includes.
>
> So I had to add all the various places that the compiler has to look
> for the headers.
>
> The short answer to "what failes without the patch" is that
> out-of-source-tree builds do not complete without these patches (or
> something close to them).
>
> Correct answer might very well be: "don't do that".  Fair enough, but
> this technique is a very standard way of building packages, especially
> autoconf packages; the fact that it failed was an unpleasant surprise.

I can't reproduce the problem.

I do
$ mkdir a
$ cd a
$ ../configure
$ make
and have no error (after the fix in revision 6579. See above)

Please give me the commands you use to get the issue.

> (And even if you don't care for the rest of the patch, you include two
> ".in" files on a list of _SOURCES in there somewhere; that should
> probably be fixed regardless of the rest of this patch.)

Fixed in revision 6580.

Thanks

--
 Dr. Ludovic Rousseau

------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete
for recognition, cash, and the chance to get your game on Steam.
$5K grand prize plus 10 genre and skill prizes. Submit your demo
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
Opensc-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH x2] support VPATH / out-of-source-tree builds

Anthony Foiani
Ludovic --

Thanks for the reply.  Sorry that it took me this long to get back to
you -- but I think I understand why I'm seeing the problem (and why
you aren't).

On Fri, Mar 29, 2013 at 4:09 AM, Ludovic Rousseau
<[hidden email]> wrote:
>
> 2013/3/28 Anthony Foiani <[hidden email]>:
> > (It might be possible to use autoconf to sub in the right paths.  I
> > don't know autoconf & friends well enough to say.)
>
> Fixed in revision 6579.

Looks good, thanks!

> I can't reproduce the problem [unable to build pcsc-wirecheck & friends].
>
> I do
> $ mkdir a
> $ cd a
> $ ../configure
> $ make
> and have no error (after the fix in revision 6579. See above)
>
> Please give me the commands you use to get the issue.
You can find it attached, but first, my analysis:

Try it again with a fresh svn checkout with only a bootstrap done on
the native machine.

If you've built from the source tree for the *native* arch, at least
once, then you're golden -- because pcsc-wirecheck-dist.c will be
created with the native executable (even if its in "noinst_", it's
still built for the "--host" arch).  The makefile tests for existance
(not regular "newer-than"), and if it exists, it just "touch"es it, so
no executable is needed.

If you try to cross-compile from a fresh checkout (as I did), then you
run into this issue.  First, the pcsc-wirecheck-dist.c file is not
created (because the local/native makefile tries to run a binary that
is build for the host); second, if you add in my patch to use native
CC directly for pcsc-wirechec-gen.c, it is created in the build tree,
not the source tree -- hence the need for all the -I and -isystem
garbage.  :(

> > (And even if you don't care for the rest of the patch, you include two
> > ".in" files on a list of _SOURCES in there somewhere; that should
> > probably be fixed regardless of the rest of this patch.)
>
> Fixed in revision 6580.

Excellent.

Best regards,
Anthony Foiani

------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete
for recognition, cash, and the chance to get your game on Steam.
$5K grand prize plus 10 genre and skill prizes. Submit your demo
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
Opensc-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/opensc-devel

pcsc-problem-report.txt (58K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH x2] support VPATH / out-of-source-tree builds

Ludovic Rousseau
2013/3/31 Anthony Foiani <[hidden email]>
> I can't reproduce the problem [unable to build pcsc-wirecheck & friends].
>
> I do
> $ mkdir a
> $ cd a
> $ ../configure
> $ make
> and have no error (after the fix in revision 6579. See above)
>
> Please give me the commands you use to get the issue.

You can find it attached, but first, my analysis:

Try it again with a fresh svn checkout with only a bootstrap done on
the native machine.

If you've built from the source tree for the *native* arch, at least
once, then you're golden -- because pcsc-wirecheck-dist.c will be
created with the native executable (even if its in "noinst_", it's
still built for the "--host" arch).  The makefile tests for existance
(not regular "newer-than"), and if it exists, it just "touch"es it, so
no executable is needed.

If you try to cross-compile from a fresh checkout (as I did), then you
run into this issue.  First, the pcsc-wirecheck-dist.c file is not
created (because the local/native makefile tries to run a binary that
is build for the host); second, if you add in my patch to use native
CC directly for pcsc-wirechec-gen.c, it is created in the build tree,
not the source tree -- hence the need for all the -I and -isystem
garbage.  :(

I now understand the problem. Cross compilation is an issue.

I can't find in your patch how you "use native CC directly"

pcsc-wirecheck-gen should only be needed by me or another pcsc-lite developper. The cleanest solution may be to include the generated file pcsc-wirecheck-dist.c (25 kB) inside the .tar.bz2 archive.

Can you try the attached patch with your configuration?

Bye

--
 Dr. Ludovic Rousseau

------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete
for recognition, cash, and the chance to get your game on Steam.
$5K grand prize plus 10 genre and skill prizes. Submit your demo
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
Opensc-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/opensc-devel

patch.txt (558 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH x2] support VPATH / out-of-source-tree builds

Anthony Foiani
Ludovic --

> I now understand the problem.

Glad to hear it -- I was starting to think I was imagining things!

Sorry that it took me a few tries to find the root cause.

> Cross compilation is an issue.

Yes, it often is.  :(

> I can't find in your patch how you "use native CC directly"

It's actually in a previous email; I referenced in passing as "builds
on my previous patch..."

Looks like it got archived here:
http://sourceforge.net/mailarchive/message.php?msg_id=30635681

(As with all my patches, I'm sure there's a nicer way of doing this,
but I don't grok autotools.  In the real kconfig systems, it shows up
as "HOSTCC" and "HOSTLD" instead of "CC" and "LD"/"CCLD" respectively,
if memory serves.)

> pcsc-wirecheck-gen should only be needed by me or another pcsc-lite
> developper. The cleanest solution may be to include the generated file
> pcsc-wirecheck-dist.c (25 kB) inside the .tar.bz2 archive.

That sounds about right.

I should probably just build a distributed tarball, and not from
source; building from svn is a leftover from when the project was in
flux last year.  (And probably just the open-sc project, at that.)

> Can you try the attached patch with your configuration?

Will try it at some point today.  Thanks!

Happy Easter, if you happen to celebrate it today...  :)

Best regards,
Anthony Foiani

------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete
for recognition, cash, and the chance to get your game on Steam.
$5K grand prize plus 10 genre and skill prizes. Submit your demo
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
Opensc-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/opensc-devel