From c53159c3b8cd35f57f8f847fc2c397f2ad32b8bf Mon Sep 17 00:00:00 2001 From: Stefan Gehn Date: Fri, 14 Aug 2015 14:30:04 +0200 Subject: [PATCH 1/2] Call pkg-config only once during build Only evaluate these shell commands once at Makefile startup, otherwise every single call to the compiler/linker will re-evaluate these lines again and again. This speeds up the build quite a bit for me. --- server/Makefile | 4 ++-- src/Makefile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/Makefile b/server/Makefile index 7050d00..05ce50b 100644 --- a/server/Makefile +++ b/server/Makefile @@ -28,8 +28,8 @@ endif GKRELLMD_INCLUDES = gkrellmd.h $(SHARED_PATH)/log.h -PKG_INCLUDE = `$(PKG_CONFIG) --cflags glib-2.0 gmodule-2.0 gthread-2.0` -PKG_LIB = `$(PKG_CONFIG) --libs glib-2.0 gmodule-2.0 gthread-2.0` +PKG_INCLUDE := $(shell $(PKG_CONFIG) --cflags glib-2.0 gmodule-2.0 gthread-2.0) +PKG_LIB := $(shell $(PKG_CONFIG) --libs glib-2.0 gmodule-2.0 gthread-2.0) FLAGS = -O2 $(PKG_INCLUDE) diff --git a/src/Makefile b/src/Makefile index 3e67bbd..2d53139 100644 --- a/src/Makefile +++ b/src/Makefile @@ -44,8 +44,8 @@ endif GKRELLM_INCLUDES = gkrellm.h gkrellm-public-proto.h $(SHARED_PATH)/log.h -PKG_INCLUDE = `$(PKG_CONFIG) --cflags gtk+-2.0 gmodule-2.0 gthread-2.0` -PKG_LIB = `$(PKG_CONFIG) --libs gtk+-2.0 gmodule-2.0 gthread-2.0` +PKG_INCLUDE := $(shell $(PKG_CONFIG) --cflags gtk+-2.0 gmodule-2.0 gthread-2.0) +PKG_LIB := $(shell $(PKG_CONFIG) --libs gtk+-2.0 gmodule-2.0 gthread-2.0) FLAGS = -O2 -I.. -I$(SHARED_PATH) $(PKG_INCLUDE) $(GTOP_INCLUDE) $(PTHREAD_INC)\ ${SSL_INCLUDE} ${NTLM_INCLUDE} -DGKRELLM_CLIENT From 4f676e4cfb768940a3292cb5cc64b2c66238d94c Mon Sep 17 00:00:00 2001 From: Stefan Gehn Date: Fri, 15 Jan 2016 17:59:55 +0100 Subject: [PATCH 2/2] Always use getaddrinfo() on Linux Expect the C runtime on Linux to always have getaddrinfo(), glibc 2.1 was released in 1999 so by now every Linux environment should have this function. This enables use of getaddrinfo() on C libraries other than glibc, i.e. on musl libc. This is an alternative approach to the patch posted to the gkrellm mailinglist by Felix Janda which unfortunately had some drawbacks on other platforms that need additional includes or libs when using getaddrinfo(), most notably Solaris and Windows. --- server/gkrellmd-private.h | 2 -- src/client.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/server/gkrellmd-private.h b/server/gkrellmd-private.h index efebadb..f5a229a 100644 --- a/server/gkrellmd-private.h +++ b/server/gkrellmd-private.h @@ -43,10 +43,8 @@ #endif #if defined(__linux__) -#if defined(__GLIBC__) && ((__GLIBC__>2)||(__GLIBC__==2 && __GLIBC_MINOR__>=1)) #define HAVE_GETADDRINFO 1 #endif -#endif #if defined(__DragonFly__) #define HAVE_GETADDRINFO 1 diff --git a/src/client.c b/src/client.c index 1ff0acb..00374d0 100644 --- a/src/client.c +++ b/src/client.c @@ -55,10 +55,8 @@ #if defined(__linux__) -#if defined(__GLIBC__) && ((__GLIBC__>2)||(__GLIBC__==2 && __GLIBC_MINOR__>=1)) #define HAVE_GETADDRINFO 1 #endif -#endif #if defined(__DragonFly__) #define HAVE_GETADDRINFO 1