genodelabs / goa

Tool for streamlining the development of Genode applications
GNU Affero General Public License v3.0
20 stars 17 forks source link

Autoconf/quirks improvements in the context of OpenSC #19

Closed m-stein closed 1 year ago

m-stein commented 2 years ago

These are fixes for some problems I encountered while building OpenSC with GOA. The autoconf support had to be improved at some points and support for using the PCSC-lite API was required.

https://github.com/m-stein/goa/commit/b9432d2d1add4cca50bc0646b4dce23c31270d7e autoconf: improve appliance of verbosity settings https://github.com/m-stein/goa/commit/f231a3bd0a9e34bfdaf063c2717a273f5db784d4 autoconf: define CPP and CXXCPP for configure https://github.com/m-stein/goa/commit/9ea55a630648e31d398b8e8e98d5724df188ac0c quirks: support using pcsc-lite api https://github.com/m-stein/goa/commit/7024fa9b71498798ed0bde4ad0794a9ecb6b77b3 autoconf: autoreconf if there's only configure.ac

nfeske commented 2 years ago

For https://github.com/m-stein/goa/commit/9ea55a630648e31d398b8e8e98d5724df188ac0c, I wonder why couldn't the port file install the pcsc-lite headers under include/PCSC/ in the first place? Wouldn't this alleviate the need for this patch?

nfeske commented 2 years ago

I merged the three autoconf-related commits to staging. Thank you very much for these sensible additions.

nfeske commented 2 years ago

I wonder why couldn't the port file install the pcsc-lite headers under include/PCSC/ in the first place?

Sorry, I have to correct myself.

I think the cleanest solution would be to add a depot recipe for an API archive (recipes/api/opensc_pkcs11/) that contains only the headers at include/. The zlib API recipe may be useful for reference (https://github.com/genodelabs/genode/blob/master/repos/libports/recipes/api/zlib/content.mk). The include: rule copies the headers from the port to the include/ location of the API archive. Goa adds all include/ sub directories of the used_apis automatically to the include search path.

m-stein commented 2 years ago

@nfeske I'm a bit confused. First, we're speaking about pcsc-lite an not pkcs11 which leaves me wondering whether you really meant recipes/api/pcsc-lite ? Second, recipes/api/pcsc-lite exists and contains a rule comparable to zlib's:

include/PCSC:
    mkdir -p $@
    cp -r $(PORT_DIR)/include/PCSC/* $@

If I remember right, the PCSC subdir was necessary as it is used in the contrib include directives.

m-stein commented 2 years ago

Another thing to note here is that the pattern I used is merely copied from how other API include dirs are treated in quirks. Furthermore, I inspected the GOA code you were referring to that adds used_api includes, and don't know exactly why it doesn't solve my problem (pcsc-lite is in my used_apis). However, it might be because the problem hits during configure and not when building (without the patch):

[pkcs11_tool:autoconf] checking for EAC_CTX_init_pace... checking for PCSC... yes
[pkcs11_tool:autoconf] checking winscard.h usability... no
[pkcs11_tool:autoconf] checking winscard.h presence... no
[pkcs11_tool:autoconf] checking for winscard.h... no
configure: error: winscard.h is required for pcsc
Error: build-directory creation via autoconf failed:
 child process exited abnormally
m-stein commented 2 years ago

Ah, I overlooked that the PCSC subdir is added to inc dirs and not include. If I modify api/pcsc-lite to this:

include:
    mkdir -p $@
    cp -r $(PORT_DIR)/include/PCSC/* $@

and remove the GOA patch, it works.

m-stein commented 2 years ago

I've updated the Genode commits accordingly and removed the GOA quirks patch from my branch.

nfeske commented 2 years ago

If I modify api/pcsc-lite to this [...] and remove the GOA patch, it works.

Very nice! Thanks for your patience.

I've updated the Genode commits accordingly

Now I'm confused. :-) Didn't we agree to host ports in genode-world?

nfeske commented 2 years ago

Didn't we agree to host ports in genode-world?

Please ignore this remark. @chelmuth cleared this up just now.

m-stein commented 2 years ago

:-) pcsc-lite and pkcs11 are easily confused I assume.

nfeske commented 1 year ago

@m-stein I wonder, can this issue be closed now?

m-stein commented 1 year ago

Yes.