1PORTNAME=	pinentry
2PORTVERSION=	1.3.2
3PORTREVISION?=	1
4CATEGORIES=	security
5MASTER_SITES=	GNUPG/pinentry
6
7MAINTAINER=	ports@MidnightBSD.org
8COMMENT?=	Collection of simple PIN or passphrase entry dialogs
9WWW=		https://www.gnupg.org/aegypten2
10
11LICENSE=	gpl2+
12LICENSE_FILE=	${WRKSRC}/COPYING
13
14USES=		tar:bzip2
15
16.if !defined(PINENTRY_GUI)
17INFO=		pinentry
18NO_ARCH=	yes
19NO_BUILD=	yes
20PLIST_FILES=	bin/pinentry
21
22OPTIONS_SINGLE=	FRONTEND
23OPTIONS_SINGLE_FRONTEND=	EFL FLTK GNOME GTK2 NCURSES QT5 QT6 TTY
24OPTIONS_DEFAULT=	NCURSES
25
26FRONTEND_DESC=	Default frontend
27
28TTY_DESC=	Console version
29PINENTRY_TTY=	pinentry-tty
30TTY_RUN_DEPENDS=	${PINENTRY_TTY}:security/pinentry-tty
31
32NCURSES_DESC=	Curses frontend
33PINENTRY_NCURSES=	pinentry-curses
34NCURSES_RUN_DEPENDS=	${PINENTRY_NCURSES}:security/pinentry-curses
35
36EFL_DESC=	EFL frontend
37PINENTRY_EFL=	pinentry-efl
38# Due to a dependency loop that exists between security/pinentry-efl,
39# devel/elf, graphics/poppler, security/gpgme-cpp, security/gpgme,
40# security/gnupg and security/pinentry, the user must install
41# pinentry-efl manually. See pkg-message.dep-loop for more details.
42#EFL_RUN_DEPENDS=	${PINENTRY_EFL}:security/pinentry-efl
43EFL_SUB_FILES=	pkg-message.dep-loop
44EFL_SUB_LIST=	PKGNAME="pinentry-efl"
45EFL_VARS=	PKGMESSAGE+=${WRKDIR}/pkg-message.dep-loop
46
47FLTK_DESC=	FLTK frontend
48PINENTRY_FLTK=	pinentry-fltk
49FLTK_RUN_DEPENDS=	${PINENTRY_FLTK}:security/pinentry-fltk
50
51GTK2_DESC=	Gtk+ 2 frontend
52PINENTRY_GTK2=	pinentry-gtk-2
53GTK2_RUN_DEPENDS=	${PINENTRY_GTK2}:security/pinentry-gtk2
54
55QT5_DESC=	Qt 5 frontend
56PINENTRY_QT5=	pinentry-qt5
57QT5_RUN_DEPENDS=	${PINENTRY_QT5}:security/pinentry-qt5
58
59QT6_DESC=	Qt 6 frontend
60PINENTRY_QT6=	pinentry-qt
61QT6_RUN_DEPENDS=	${PINENTRY_QT6}:security/pinentry-qt6
62
63GNOME_DESC=	GNOME frontend
64PINENTRY_GNOME=	pinentry-gnome3
65# Due to a dependency loop that exists between security/pinentry-gnome,
66# security/gcr, security/gnupg and security/pinentry, the user must install
67# pinentry-gnome manually. See pkg-message.dep-loop for more details.
68#GNOME_RUN_DEPENDS=	${PINENTRY_GNOME}:security/pinentry-gnome
69GNOME_SUB_FILES=pkg-message.dep-loop
70GNOME_SUB_LIST=	PKGNAME="pinentry-gnome"
71GNOME_VARS=	PKGMESSAGE+=${WRKDIR}/pkg-message.dep-loop
72
73.include <bsd.mport.options.mk>
74
75.for gui in ${OPTIONS_SINGLE_FRONTEND}
76. if ${PORT_OPTIONS:M${gui}}
77PINENTRY_BIN=	${PINENTRY_${gui}}
78. endif
79.endfor
80
81do-install:
82	cd ${PREFIX}/bin/ && ${LN} -sf ${PINENTRY_BIN} pinentry
83	${MKDIR} ${PREFIX}/${INFO_PATH}
84	${INSTALL_DATA} ${WRKSRC}/doc/pinentry.info ${PREFIX}/${INFO_PATH}
85
86.else # !defined(PINENTRY_GUI)
87PKGNAMESUFFIX=	-${PINENTRY_GUI}
88LIB_DEPENDS=	libassuan.so:security/libassuan \
89		libgpg-error.so:security/libgpg-error
90
91USES+=		gmake iconv localbase ncurses pkgconfig
92GNU_CONFIGURE=	yes
93CONFIGURE_ARGS=	--disable-pinentry-emacs
94LDFLAGS+=	-Wl,--as-needed
95
96OPTIONS_DEFINE=	LIBSECRET
97
98LIBSECRET_DESC=	Saving the passphrase with libsecret
99LIBSECRET_CONFIGURE_ENABLE=	libsecret
100LIBSECRET_LIB_DEPENDS=	libsecret-1.so:security/libsecret
101LIBSECRET_USES=		gnome
102LIBSECRET_USE=		GNOME=glib20
103
104.if ${PINENTRY_GUI} == "gnome"
105OPTIONS_SLAVE=	LIBSECRET
106LIB_DEPENDS+=	libgcr-base-3.so:security/gcr3
107PLIST_FILES=	bin/pinentry-gnome3
108.else
109CONFIGURE_ARGS+=--disable-pinentry-gnome3
110.endif
111
112.if ${PINENTRY_GUI} == "qt5"
113USES+=		compiler:c++11-lang kde:5 qt:5 xorg
114USE_KDE=	wayland
115USE_QT=		core gui widgets x11extras buildtools:build
116USE_XORG=	x11
117PLIST_FILES=	bin/pinentry-qt5 \
118		share/applications/org.gnupg.pinentry-qt5.desktop \
119		share/pixmaps/pinentry-qt5.png
120CONFIGURE_ARGS+=--enable-pinentry-qt5
121.else
122CONFIGURE_ARGS+=--disable-pinentry-qt5
123.endif
124
125.if ${PINENTRY_GUI} == "qt6"
126USES+=		compiler:c++17-lang kde:6 qt:6
127USE_CXXSTD=	c++17
128USE_KDE=	guiaddons windowsystem
129USE_QT=		base
130PLIST_FILES=	bin/pinentry-qt \
131		share/applications/org.gnupg.pinentry-qt.desktop \
132		share/pixmaps/pinentry.png
133CONFIGURE_ARGS+=--enable-pinentry-qt
134.else
135CONFIGURE_ARGS+=--disable-pinentry-qt
136.endif
137
138.if ${PINENTRY_GUI} == "gtk2"
139USES+=		gnome
140USE_GNOME+=	gtk20
141PLIST_FILES=	bin/pinentry-gtk-2
142.else
143CONFIGURE_ARGS+=--disable-pinentry-gtk2
144.endif
145
146.if ${PINENTRY_GUI} == "efl"
147LIB_DEPENDS+=	libefl.so:devel/efl
148PLIST_FILES=	bin/pinentry-efl
149.else
150CONFIGURE_ARGS+=--disable-pinentry-efl
151.endif
152
153.if ${PINENTRY_GUI} == "fltk"
154USES+=		compiler:c++11-lib
155LIB_DEPENDS+=	libfltk.so:x11-toolkits/fltk
156PLIST_FILES=	bin/pinentry-fltk
157.else
158CONFIGURE_ARGS+=--disable-pinentry-fltk
159.endif
160
161.if ${PINENTRY_GUI} == "curses"
162PLIST_FILES=	bin/pinentry-curses
163.else
164CONFIGURE_ARGS+=--disable-pinentry-curses
165.endif
166
167.if ${PINENTRY_GUI} == "tty"
168PLIST_FILES=	bin/pinentry-tty
169CONFIGURE_ARGS+=--enable-pinentry-tty
170.else
171CONFIGURE_ARGS+=--disable-pinentry-tty
172.endif
173
174# Rename icon to prevent install conflicts with the Qt6 frontend.
175post-extract:
176	@(cd ${WRKSRC}/qt5/icons && ${MV} pinentry.png pinentry-qt5.png)
177
178post-install:
179	-${RM} ${PREFIX}/bin/pinentry \
180		${PREFIX}/share/info/pinentry.info
181
182.endif # !defined(PINENTRY_GUI)
183
184.include <bsd.port.mk>
185