diff mbox series

[OpenWrt-Devel] zlib: Use relative paths in pkg-config metadata file

Message ID 20190502164706.31453-1-jeffery.to@gmail.com
State Superseded
Delegated to: Petr Štetiar
Headers show
Series [OpenWrt-Devel] zlib: Use relative paths in pkg-config metadata file | expand

Commit Message

Jeffery To May 2, 2019, 4:47 p.m. UTC
The default zlib.pc file generated by cmake contains absolute paths.
This patches the file to use relative paths (relative to ${prefix} and
${exec_prefix}).

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
---
 package/libs/zlib/Makefile                         |  2 +-
 .../patches/004-relative-pkg-config-paths.patch    | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 package/libs/zlib/patches/004-relative-pkg-config-paths.patch

Comments

Rosen Penev May 2, 2019, 8:13 p.m. UTC | #1
On Thu, May 2, 2019 at 9:47 AM Jeffery To <jeffery.to@gmail.com> wrote:
>
> The default zlib.pc file generated by cmake contains absolute paths.
> This patches the file to use relative paths (relative to ${prefix} and
> ${exec_prefix}).
git grep with-zlib= | wc -l in the packages repo returns 12. I wonder
if this fixes them...
>
> Signed-off-by: Jeffery To <jeffery.to@gmail.com>
> ---
>  package/libs/zlib/Makefile                         |  2 +-
>  .../patches/004-relative-pkg-config-paths.patch    | 14 ++++++++++++++
>  2 files changed, 15 insertions(+), 1 deletion(-)
>  create mode 100644 package/libs/zlib/patches/004-relative-pkg-config-paths.patch
>
> diff --git a/package/libs/zlib/Makefile b/package/libs/zlib/Makefile
> index 4a2a0e53b0..c7a8415c79 100644
> --- a/package/libs/zlib/Makefile
> +++ b/package/libs/zlib/Makefile
> @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
>
>  PKG_NAME:=zlib
>  PKG_VERSION:=1.2.11
> -PKG_RELEASE:=2
> +PKG_RELEASE:=3
>
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
>  PKG_SOURCE_URL:=@SF/libpng http://www.zlib.net
> diff --git a/package/libs/zlib/patches/004-relative-pkg-config-paths.patch b/package/libs/zlib/patches/004-relative-pkg-config-paths.patch
> new file mode 100644
> index 0000000000..c86d19b412
> --- /dev/null
> +++ b/package/libs/zlib/patches/004-relative-pkg-config-paths.patch
> @@ -0,0 +1,14 @@
> +--- a/zlib.pc.cmakein
> ++++ b/zlib.pc.cmakein
> +@@ -1,8 +1,8 @@
> + prefix=@CMAKE_INSTALL_PREFIX@
> + exec_prefix=@CMAKE_INSTALL_PREFIX@
> +-libdir=@INSTALL_LIB_DIR@
> +-sharedlibdir=@INSTALL_LIB_DIR@
> +-includedir=@INSTALL_INC_DIR@
> ++libdir=${exec_prefix}/lib
> ++sharedlibdir=${exec_prefix}/lib
> ++includedir=${prefix}/include
> +
> + Name: zlib
> + Description: zlib compression library
> --
> 2.20.1
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Petr Štetiar May 3, 2019, 9:32 a.m. UTC | #2
Jeffery To <jeffery.to@gmail.com> [2019-05-03 00:47:06]:

> The default zlib.pc file generated by cmake contains absolute paths.
> This patches the file to use relative paths (relative to ${prefix} and
> ${exec_prefix}).

I can see that from the diff already, but I miss the information, why do you
need this change. Could this perhaps be upstreamed first as well?

-- ynezz
Jeffery To May 15, 2019, 1 p.m. UTC | #3
On Fri, May 3, 2019 at 5:32 PM Petr Štetiar <ynezz@true.cz> wrote:

> Jeffery To <jeffery.to@gmail.com> [2019-05-03 00:47:06]:
>
> > The default zlib.pc file generated by cmake contains absolute paths.
> > This patches the file to use relative paths (relative to ${prefix} and
> > ${exec_prefix}).
>
> I can see that from the diff already, but I miss the information, why do
> you
> need this change. Could this perhaps be upstreamed first as well?
>
> -- ynezz
>

The buildroot pkg-config (in staging_dir/host/bin) overrides the prefix and
exec_prefix variables in *.pc files, to supply the correct (buildroot)
paths for callers. If other variables are not defined relative to prefix
and exec_prefix, then the returned values will be incorrect.

A similar change was merged for xz[1] in the packages repo.

I'm not sure upstream will want this change, since what is there currently
isn't "wrong"; it only affects our cross-compilation.


1. https://github.com/openwrt/packages/pull/8880
Petr Štetiar May 15, 2019, 1:33 p.m. UTC | #4
Jeffery To <jeffery.to@gmail.com> [2019-05-15 21:00:28]:

> The buildroot pkg-config (in staging_dir/host/bin) overrides the prefix and
> exec_prefix variables in *.pc files, to supply the correct (buildroot)
> paths for callers. If other variables are not defined relative to prefix
> and exec_prefix, then the returned values will be incorrect.

Ok, makes sense, so can you add this explanation to the commit message please?
Jeffery To May 15, 2019, 2:26 p.m. UTC | #5
On Wed, May 15, 2019 at 9:33 PM Petr Štetiar <ynezz@true.cz> wrote:

> Jeffery To <jeffery.to@gmail.com> [2019-05-15 21:00:28]:
>
> > The buildroot pkg-config (in staging_dir/host/bin) overrides the prefix
> and
> > exec_prefix variables in *.pc files, to supply the correct (buildroot)
> > paths for callers. If other variables are not defined relative to prefix
> > and exec_prefix, then the returned values will be incorrect.
>
> Ok, makes sense, so can you add this explanation to the commit message
> please?
>

Sure, will do.
diff mbox series

Patch

diff --git a/package/libs/zlib/Makefile b/package/libs/zlib/Makefile
index 4a2a0e53b0..c7a8415c79 100644
--- a/package/libs/zlib/Makefile
+++ b/package/libs/zlib/Makefile
@@ -9,7 +9,7 @@  include $(TOPDIR)/rules.mk
 
 PKG_NAME:=zlib
 PKG_VERSION:=1.2.11
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@SF/libpng http://www.zlib.net
diff --git a/package/libs/zlib/patches/004-relative-pkg-config-paths.patch b/package/libs/zlib/patches/004-relative-pkg-config-paths.patch
new file mode 100644
index 0000000000..c86d19b412
--- /dev/null
+++ b/package/libs/zlib/patches/004-relative-pkg-config-paths.patch
@@ -0,0 +1,14 @@ 
+--- a/zlib.pc.cmakein
++++ b/zlib.pc.cmakein
+@@ -1,8 +1,8 @@
+ prefix=@CMAKE_INSTALL_PREFIX@
+ exec_prefix=@CMAKE_INSTALL_PREFIX@
+-libdir=@INSTALL_LIB_DIR@
+-sharedlibdir=@INSTALL_LIB_DIR@
+-includedir=@INSTALL_INC_DIR@
++libdir=${exec_prefix}/lib
++sharedlibdir=${exec_prefix}/lib
++includedir=${prefix}/include
+ 
+ Name: zlib
+ Description: zlib compression library