genodelabs / goa

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

autoconf: use API archives for pkg-config #81

Open cnuke opened 5 months ago

cnuke commented 5 months ago

While porting uacme I encountered configure problems because host libraries got picked up instead of the ones provides by Genode. Since we already went down the road of providing cmake files in the API archives doing the same for pkg-config feels natural.

cnuke commented 5 months ago

The commits above show-case the approach but are not finalized yet.

jschlatow commented 5 months ago

That looks very reasonable to me.

By the way, the more include-specific quirks I see being added to Goa, the more I feel the urge to make use of the import-*.mk files instead.

nfeske commented 5 months ago

By the way, the more include-specific quirks I see being added to Goa, the more I feel the urge to make use of the import-*.mk files instead.

Alternatively, we could think about introducing conventions that API archives are expected to follow, similar to the convention of the Genode build system that incorporates include// into the include-search paths whereas the values depend on the architecture. Right now, Goa has only the single obvious convention that headers are searched in include/, which apparently doesn't cut it.

In the case of OpenSSL, it is a bit strange to see the include path pointing into src/. Maybe the archive could mirror the headers at include?

jschlatow commented 5 months ago

Alternatively, we could think about introducing conventions that API archives are expected to follow, similar to the convention of the Genode build system that incorporates include// into the include-search paths whereas the values depend on the architecture. Right now, Goa has only the single obvious convention that headers are searched in include/, which apparently doesn't cut it.

Except for a few special cases (e.g. SDL/SDL2 which required include/SDL2 being added into the include-search paths) introducing architecture-specific conventions should eliminate most quirks.

In the case of OpenSSL, it is a bit strange to see the include path pointing into src/. Maybe the archive could mirror the headers at include?

That's a common pattern if the include files don't reside in the contrib directory but at src/lib/....

jschlatow commented 5 months ago

Right now, Goa has only the single obvious convention that headers are searched in include/, which apparently doesn't cut it.

@nfeske I just noticed that Goa indeed already has a policy in place to add architecture-specific includes paths. The point of the existing quirks is actually that, for some libraries, we need additional subdirectories in the include paths.

nfeske commented 5 months ago

Thanks @jschlatow for the clarification. So we are fine already in this respect. I'm sorry for the noise.

jschlatow commented 5 months ago

I had a go at implementing support for import-*.mk files, which turned out to be pretty straightforward. @cnuke At any time that suits you, could you try whether commit b18045e would render 0f2a16c unnecessary?

cnuke commented 4 months ago

@jschlatow thanks for the commit - I've cherry-picked b18045e (and the fixup commit on your branch). It works fine but I had to adapt the openssl api archive as it is - naturally - the odd one out by not providing import-openssl.mk. As a quick-fix, commit 16300fc introduces this somewhat artificial file to remedy that for testing purposes.

chelmuth commented 3 months ago

@cnuke I'm ready to merge the preparatory commits (curl, openssl) to genode staging. Please merge the following cleanup into the import-openssl.mk commit.

diff --git a/repos/libports/lib/import/import-libcrypto.mk b/repos/libports/lib/import/import-libcrypto.mk
index 3878ca4a8c8..bd8a17b9d39 100644
--- a/repos/libports/lib/import/import-libcrypto.mk
+++ b/repos/libports/lib/import/import-libcrypto.mk
@@ -1,9 +1,9 @@
 LIB_OPENSSL_DIR = $(call select_from_repositories,src/lib/openssl)

-ARCH = $(filter 32bit 64bit,$(SPECS))
-
 OPENSSL_DIR := $(call select_from_ports,openssl)

+ARCH = $(filter 32bit 64bit,$(SPECS))
+
 INC_DIR += $(OPENSSL_DIR)/include
 INC_DIR += $(LIB_OPENSSL_DIR)/spec/$(ARCH)

diff --git a/repos/libports/lib/import/import-libssl.mk b/repos/libports/lib/import/import-libssl.mk
index 54ea68accec..1c50108524d 100644
--- a/repos/libports/lib/import/import-libssl.mk
+++ b/repos/libports/lib/import/import-libssl.mk
@@ -2,9 +2,9 @@ LIB_OPENSSL_DIR = $(call select_from_repositories,src/lib/openssl)

 OPENSSL_DIR := $(call select_from_ports,openssl)

-LIBS += libcrypto
-
 ARCH = $(filter 32bit 64bit,$(SPECS))

 INC_DIR += $(OPENSSL_DIR)/include
 INC_DIR += $(LIB_OPENSSL_DIR)/spec/$(ARCH)
+
+LIBS += libcrypto
cnuke commented 3 months ago

@chelmuth commit b93f1f contains the cleaned-up commit.