Skip to contentSkip to conversation

pnmtohex: Optionally use pkg-config for netpbm

PATCH In review Geert Uytterhoeven 2 participants 3 messages Mar 26, 2023 – Apr 3, 2023 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pnmtohex: Optionally use pkg-config for netpbm

As of libnetpbm11 in Debian/Ubuntu, the netpbm header files are no longer located in the root include directory, but in a netbpm subdirectory. Fortunately the same version added support for pkg-config.

Support both old and new systems by using pkg-config, when available.

---
Helge: Does this fix the issue for you. I don't have a system with
libnetpbm11 handy yet.

 Rules.make        | 2 +-
 pnmtohex/Makefile | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
Rules.make +1 -1
index 51c4e9431699d2f3..b9a098d5e0f409cb 100644
@@ -5,7 +5,7 @@ HOSTCC = gcc
 IFLAGS = -I$(TOPDIR)/include
 #DFLAGS = -g
 OFLAGS = -O3 -fomit-frame-pointer
-CFLAGS = -Wall -Werror $(IFLAGS) $(DFLAGS) $(OFLAGS)
+CFLAGS += -Wall -Werror $(IFLAGS) $(DFLAGS) $(OFLAGS)
 
 SRCS += $(wildcard *.c)
 OBJS += $(subst .c,.o,$(SRCS))
pnmtohex/Makefile +3 -0
index d89c8e448db0c527..642a26f0c10c3bc2 100644
@@ -3,9 +3,12 @@ TOPDIR = ..
 
 HOST_TARGET = pnmtohex
 
+CFLAGS += $(shell pkg-config --exists netpbm && pkg-config --cflags netpbm)
+
 # Modern distro's (e.g. Debian, Fedora Core) seem to have -lnetpbm only
 #LIBS += -lnetpnm -lnetpbm -lnetpgm -lnetppm
 LIBS += -lnetpbm
+LIBS += $(shell pkg-config --exists netpbm && pkg-config --libs netpbm)
 
 include $(TOPDIR)/Rules.make
 
Signature · 1 line
2.34.1
maintainer Tested-by on v1 1/1
#1 lore raw

* Geert Uytterhoeven <[email protected]>:

Quoted 5 lines

As of libnetpbm11 in Debian/Ubuntu, the netpbm header files are no longer located in the root include directory, but in a netbpm subdirectory. Fortunately the same version added support for pkg-config.

Quoted 7 lines

Support both old and new systems by using pkg-config, when available.

---
Helge: Does this fix the issue for you. I don't have a system with
libnetpbm11 handy yet.

Yes, thanks a lot!

That fixes the build on parisc on Debian 12.0 for me. You may add:

I tried on my Fedora 36/x86_64 as well, and there netpbm-devel sadly comes without pkg-config. Nevertheless, based on top of your patch by hacking in the include path fixed the issue there as well.
Maybe you can consider applying below patch on top of yours as too?

Helge
---------

[PATCH] Add netpbm to include search patch

Netpbm on Fedora 36 comes without pkg-config, so
manually add the include path.

---

pnmtohex/Makefile +1 -0
index 642a26f..d8925a9 100644
@@ -4,6 +4,7 @@ TOPDIR = ..
 HOST_TARGET = pnmtohex
 
 CFLAGS += $(shell pkg-config --exists netpbm && pkg-config --cflags netpbm)
+CFLAGS += -I/usr/include/netpbm
 
 # Modern distro's (e.g. Debian, Fedora Core) seem to have -lnetpbm only
 #LIBS += -lnetpnm -lnetpbm -lnetpgm -lnetppm
author Reviewed-by
#2 lore raw
Quoted 29 lines · Helge Deller

* Geert Uytterhoeven <[email protected]>:

Quoted 5 lines

As of libnetpbm11 in Debian/Ubuntu, the netpbm header files are no longer located in the root include directory, but in a netbpm subdirectory. Fortunately the same version added support for pkg-config.

Quoted 7 lines

Support both old and new systems by using pkg-config, when available.

---
Helge: Does this fix the issue for you. I don't have a system with
libnetpbm11 handy yet.

Yes, thanks a lot!

That fixes the build on parisc on Debian 12.0 for me. You may add:

I tried on my Fedora 36/x86_64 as well, and there netpbm-devel sadly comes without pkg-config. Nevertheless, based on top of your patch by hacking in the include path fixed the issue there as well.
Maybe you can consider applying below patch on top of yours as too?

Helge
---------

Quoted 6 lines

[PATCH] Add netpbm to include search patch

Netpbm on Fedora 36 comes without pkg-config, so
manually add the include path.

and applying.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds