-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add pkg-config support for erl_interface #4527
base: master
Are you sure you want to change the base?
Conversation
Hello, I'm not sure with installing .pc (pkg-config files) is something desired. However, I have some use cases where pkg-config is useful when solving cross-compilation build. Also, I'm not mastering in autoconf and I tried to hook the .pc installation for erl_interface. |
lib/erl_interface/src/Makefile.in
Outdated
@@ -683,6 +690,8 @@ release: opt | |||
$(INSTALL_DIR) "$(RELSYSDIR)/src/prog" | |||
$(INSTALL_DIR) "$(RELEASE_PATH)/usr/include" | |||
$(INSTALL_DIR) "$(RELEASE_PATH)/usr/lib" | |||
$(INSTALL_DIR) "$(DESTDIR)/$(libdir)/pkgconfig" | |||
$(INSTALL_DATA) $(PKG-CONFIG) "$(DESTDIR)/$(libdir)/pkgconfig" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are problematic. It is possible to install OTP using paths determined by configure
(and then this will work), but also using an explicitly given path at install time. This either using make release RELEASE_ROOT=<PATH>
or ./otp_build release [-a] <PATH>
. When giving the path at install time this will install erl_ei.pc
at a completely different place than where OTP is installed.
A solution could be to only install erl_ei.pc
when installing OTP using make install
at the top. Info indicating that we are installing using the configure
d path then needs to be passed down to this make file. This can for example be done via a make variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I got it.
f1eeb74
to
f025908
Compare
lib/erl_interface/src/Makefile.in
Outdated
PKG-CONFIG = \ | ||
$(TARGET)/erl_ei.pc | ||
|
||
ifneq ($(DESTDIR),) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When calling ./otp_build release [-a] <PATH>
or make release RELEASE_ROOT=<PATH>
the DESTDIR is not defined, thus the pkg-config rule will not be called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but DESTDIR
is not necessarily used when installing with make install
, so now erl_ei.pc
will be lost when not using DESTDIR
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. My next version will be like this:
./configure --enable-pkg-config
make install DESTDIR=<PATH>
or
make install
Both will install pkg-config .pc file because the user has enabled pkg-config. However for otp_build release
and make release
cases, it will not take effect if the user hasn't enabled the pkg-config.
f025908
to
ddc7212
Compare
ddc7212
to
eaa3e8e
Compare
pkg-config is a helper tool used when compiling applications and libraries. This commit introduces the file erl_ei.pc which will be installed in the standard pkg-config directory. Thus, using pkg-config like this: pkg-config --libs --cflags erl_ei Returns the correct libs and cflags that can be used by build tools (like autotools); -I/cross/sysroots/core2-32-vendor-linux/usr/lib/erlang/lib/erl_interface-4.0.2/include -L/cross/sysroots/core2-32-vendor-linux/usr/lib/erlang/lib/erl_interface-4.0.2/lib -lei In order to enable the pkg-config installation a new configure option, --enable-pkg-config, was introduced. The default is not install the pkg-config file. And one could enable it using --enable-pkg-config argument when calling configure script.
This commit introduces the file erl_erts.pc which will be installed in the standard pkg-config directory. Thus, using pkg-config like this: pkg-config --libs --cflags erl_erts Returns the correct libs and cflags that can be used by build tools (like autotools): -I/cross/sysroots/core2-32-vendor-linux/usr/lib/erlang/erts-11.1.8/include
eaa3e8e
to
a004f4d
Compare
pkg-config is a helper tool used when compiling applications and
libraries.
This commit introduces the file erl_ei.pc which will be installed
in the standard pkg-config directory.
Thus, using pkg-config like this:
Returns the correct libs and cflags that can be used by build tools
(like autotools);