net-mgmt/wifimgr: allow to optionally build against GTK v2

It is still supported by upstream, even though default is now GTK v3.
All that was missing is some make(1) glue to distinguish between the
toolkit versions.
This commit is contained in:
Alexey Dokuchaev 2021-07-03 18:45:54 +00:00
parent 18860205ed
commit e358a2f1d8
2 changed files with 41 additions and 5 deletions

View File

@ -16,13 +16,17 @@ LIB_DEPENDS= libfontconfig.so:x11-fonts/fontconfig \
libfreetype.so:print/freetype2
USES= desktop-file-utils gnome pkgconfig tar:bzip2 xorg
USE_GNOME= cairo gtk30
USE_GNOME= cairo
INSTALLS_ICONS= yes
USE_XORG= x11
OPTIONS_DEFINE= NLS
OPTIONS_DEFINE= GTK2 NLS
OPTIONS_SUB= yes
GTK2_USE= GNOME=gtk20
GTK2_MAKE_ENV= GTK_VERSION=2
GTK2_USE_OFF= GNOME=gtk30
NLS_USES= gettext-runtime gettext-tools
NLS_MAKE_ENV_OFF= WITHOUT_NLS=yes
NLS_CFLAGS_OFF= -DWITHOUT_NLS

View File

@ -1,6 +1,38 @@
--- src/Makefile.orig 2014-05-10 22:54:38 UTC
--- src/Makefile.orig 2021-06-28 10:55:25 UTC
+++ src/Makefile
@@ -97,7 +97,7 @@ clean:
@@ -6,9 +6,11 @@
# $Id: Makefile 145 2021-06-28 10:55:25Z jr $
#
-GTK_CFLAGS != pkg-config --cflags gtk+-3.0
-GTK_LDFLAGS != pkg-config --libs gtk+-3.0
+GTK_VERSION ?= 3
+GTK_CFLAGS != pkg-config --cflags gtk+-${GTK_VERSION}.0
+GTK_LDFLAGS != pkg-config --libs gtk+-${GTK_VERSION}.0
+
.if defined(WITHOUT_NLS)
CFLAGS += -DWITHOUT_NLS
.else
@@ -71,7 +73,7 @@ installed = ${DESTDIR}${PREFIX}/bin/wifimgr \
all: wifimgr wifimgrsu
-wmgr_objs = wifimgr.o string.o net_list.o wifimgr-gtk.o
+wmgr_objs = wifimgr.o string.o net_list.o wifimgr-gtk${GTK_VERSION}.o
wifimgr: ${wmgr_objs}
${CC} -o $@ ${wmgr_objs} ${LDFLAGS}
@@ -82,7 +84,7 @@ string.o: string.c
net_list.o: net_list.c wifimgr.h
-wifimgr-gtk.o: wifimgr-gtk.c wifimgr.h version.h
+wifimgr-gtk${GTK_VERSION}.o: wifimgr-gtk${GTK_VERSION}.c wifimgr.h version.h
wmgrsu_objs = wifimgrsu.o string.o
@@ -97,7 +99,7 @@ clean:
rm -f *.o
rm -f *.core
@ -9,7 +41,7 @@
deinstall: do-deinstall update-icon-cache
@@ -113,7 +113,7 @@ ${DESTDIR}${PREFIX}/bin/wifimgr: wifimgr
@@ -113,7 +115,7 @@ ${DESTDIR}${PREFIX}/bin/wifimgr: wifimgr
${INSTALL} $? $@
${DESTDIR}${PREFIX}/libexec/wifimgrsu: wifimgrsu