Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoconf: use API archives for pkg-config #81

Open
cnuke opened this issue Jan 16, 2024 · 10 comments
Open

autoconf: use API archives for pkg-config #81

cnuke opened this issue Jan 16, 2024 · 10 comments
Labels

Comments

@cnuke
Copy link
Member

cnuke commented Jan 16, 2024

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 cnuke added the feature label Jan 16, 2024
cnuke added a commit to cnuke/goa that referenced this issue Jan 16, 2024
cnuke added a commit to cnuke/goa that referenced this issue Jan 16, 2024
cnuke added a commit to cnuke/genode that referenced this issue Jan 16, 2024
cnuke added a commit to cnuke/goa-projects that referenced this issue Jan 16, 2024
cnuke added a commit to cnuke/genode that referenced this issue Jan 16, 2024
@cnuke
Copy link
Member Author

cnuke commented Jan 16, 2024

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

@jschlatow
Copy link
Member

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
Copy link
Member

nfeske commented Jan 18, 2024

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

nfeske commented Jan 31, 2024

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

jschlatow added a commit to jschlatow/goa that referenced this issue Jan 31, 2024
If a used API contains an import-<api-name>.mk file, we evalute this in
order to set the include directories appropriately. This relieves us
from most quirks.

genodelabs#81
@jschlatow
Copy link
Member

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 added a commit to cnuke/genode that referenced this issue Mar 8, 2024
cnuke added a commit to cnuke/genode that referenced this issue Mar 8, 2024
cnuke added a commit to cnuke/genode that referenced this issue Mar 8, 2024
For now this import file is solely there to satisfy the mechansim
in Goa that collecteds an incorporates import files for used APIs.

Issue genodelabs/goa#81.
@cnuke
Copy link
Member Author

cnuke commented Mar 8, 2024

@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
Copy link
Member

@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 added a commit to cnuke/genode that referenced this issue Mar 12, 2024
For now this import file is solely there to satisfy the mechansim
in Goa that collects and incorporates import files for used APIs.

Issue genodelabs/goa#81.
@cnuke
Copy link
Member Author

cnuke commented Mar 12, 2024

@chelmuth commit b93f1f contains the cleaned-up commit.

chelmuth pushed a commit to genodelabs/genode that referenced this issue Mar 12, 2024
For now this import file is solely there to satisfy the mechansim
in Goa that collects and incorporates import files for used APIs.

Issue genodelabs/goa#81.
chelmuth pushed a commit to genodelabs/genode that referenced this issue Apr 12, 2024
For now this import file is solely there to satisfy the mechansim
in Goa that collects and incorporates import files for used APIs.

Issue genodelabs/goa#81.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants