summaryrefslogtreecommitdiff
path: root/x11/xlockmore/Makefile.common
blob: 3878d0fde546bed48e9c830fe5fbd339a9c9caf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# $NetBSD: Makefile.common,v 1.76 2017/09/06 09:03:06 wiz Exp $
#
# used by x11/xlockmore/Makefile
# used by x11/xlockmore-lite/Makefile

DISTNAME=	xlockmore-5.46
CATEGORIES=	x11
MASTER_SITES=	http://www.tux.org/~bagleyd/xlock/
MASTER_SITES+=	ftp://ibiblio.org/pub/Linux/X11/screensavers/
EXTRACT_SUFX=	.tar.xz

MAINTAINER=	pkgsrc-users@NetBSD.org
HOMEPAGE=	https://www.tux.org/~bagleyd/xlockmore.html

CONFLICTS+=	xlockmore-[0-9]* xlockmore-lite-[0-9]*

DISTINFO_FILE?=		${.CURDIR}/../xlockmore/distinfo
PATCHDIR?=		${.CURDIR}/../xlockmore/patches
PLIST_SRC?=		${.CURDIR}/../xlockmore/PLIST
FILESDIR?=		${.CURDIR}/../xlockmore/files
MESSAGE_SRC?=		${.CURDIR}/../xlockmore/MESSAGE

.include "../../mk/bsd.prefs.mk"

PKG_OPTIONS_VAR=	PKG_OPTIONS.xlockmore
PKG_SUPPORTED_OPTIONS=	xlockmore-allow-root xlockmore-dpms pam
.if ${OPSYS} == "NetBSD"
PKG_SUPPORTED_OPTIONS+=	oss
.endif
PKG_SUGGESTED_OPTIONS=	xlockmore-allow-root xlockmore-dpms
PKG_OPTIONS_LEGACY_VARS+=XLOCK_DISABLE_ALLOW_ROOT:-xlockmore-allow-root
PKG_OPTIONS_LEGACY_VARS+=XLOCK_NO_DPMS:-xlockmore-dpms

.include "../../mk/bsd.options.mk"

USE_LANGUAGES=		c c++
USE_TOOLS+=		xmkmf

XLOCK_SOUNDDIR=		${PREFIX}/lib/X11/xlock/sounds
XLOCK_MODULEDIR=	${PREFIX}/lib/X11/xlock/modules

DEFINES+=		-DDEF_MODULEPATH="\"${XLOCK_MODULEDIR}\""
CPPFLAGS+=		${DEFINES}
CXXFLAGS+=		${DEFINES}

GNU_CONFIGURE=		YES
CONFIGURE_ARGS+=	--without-motif
CONFIGURE_ARGS+=	--without-editres
CONFIGURE_ARGS+=	--without-dtsaver
CONFIGURE_ARGS+=	--without-rplay
CONFIGURE_ARGS+=	--without-nas
CONFIGURE_ARGS+=	--without-gtk
CONFIGURE_ARGS+=	--without-esound
CONFIGURE_ARGS+=	--enable-appdefaultdir=${PREFIX}/lib/X11/app-defaults
CONFIGURE_ENV+=		ac_cv_x_app_defaults=${PREFIX}/lib/X11/app-defaults/XLock

CONF_FILES+=		${EGDIR}/app-defaults/XLock ${PREFIX}/lib/X11/app-defaults/XLock

.if ${OPSYS} == "NetBSD"
XLOCK_AUDIOPLAY?=	/usr/bin/audioplay
CONFIGURE_ARGS+=	--enable-def-play=${XLOCK_AUDIOPLAY:Q}
.endif

.if empty(PKG_OPTIONS:Mxlockmore-dpms)
CONFIGURE_ARGS+=	--without-dpms
.else
.  if ${X11_TYPE} != "native" || !exists(${X11BASE}/lib${LIBABISUFFIX}/libXdpms.a)
BUILDLINK_TRANSFORM+=	l:Xdpms:Xext
.  endif
DPMS_ENV=	no_dpms= ac_dpms_includes=${BUILDLINK_PREFIX.xextproto}/include ac_dpms_libraries=${BUILDLINK_PREFIX.libXext}/lib
CONFIGURE_ENV+=		ac_cv_path_dpms=${DPMS_ENV:Q}
.endif

.if empty(PKG_OPTIONS:Mxlockmore-allow-root)
CONFIGURE_ARGS+=	--disable-allow-root
.endif

.if !empty(PKG_OPTIONS:Mpam)
.  include "../../mk/pam.buildlink3.mk"
CONFIGURE_ARGS+=	--enable-pam --enable-bad-pam
.else
CONFIGURE_ARGS+=	--disable-pam
.endif

#
# Special permissions of bin/xlock if any.
#
.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "NetBSD" || ${OPSYS} == "OpenBSD" || \
    ${OPSYS} == "DragonFly" || ${OPSYS} == "SunOS"
SPECIAL_PERMS+=	bin/xlock ${SETUID_ROOT_PERMS}
.elif ${OPSYS} == "Linux"
# setgid shadow should be enough for modern Linux
SPECIAL_PERMS+=	bin/xlock ${REAL_ROOT_USER} shadow 2511
.endif

EGDIR=			${PREFIX}/share/examples/xlock
MESSAGE_SUBST+=		EGDIR=${EGDIR:Q}
INSTALLATION_DIRS+=	${EGDIR}/pam.d

# XXX framework bug: while we don't need it, this would kill
# the inherited full dependency
#BUILDLINK_DEPMETHOD.libXt?=	build

.include "../../x11/libICE/buildlink3.mk"
.include "../../x11/libSM/buildlink3.mk"
.include "../../x11/libX11/buildlink3.mk"
.include "../../x11/libXext/buildlink3.mk"
.include "../../x11/libXinerama/buildlink3.mk"
.include "../../x11/libXt/buildlink3.mk"
.include "../../x11/xextproto/buildlink3.mk"

XINERAMA_ENV=	no_xenerama= ac_xinerama_includes=${BUILDLINK_PREFIX.libXinerama}/include ac_xinerama_libraries=${BUILDLINK_PREFIX.libXinerama}/lib
CONFIGURE_ENV+=	ac_cv_path_xinerama=${XINERAMA_ENV:Q}

# Set the complete paths to the sound files and set the default xlock
# mode/screensaver.
#
post-patch:
	cd ${WRKSRC}/xlock;						\
	${MV} -f XLock.ad XLock.ad.presed;				\
	${SED}	-e "s|/usr/lib/|${PREFIX}/lib/|g"			\
		XLock.ad.presed > XLock.ad;				\
	${RM} -f XLock.ad.presed
.if defined(XLOCK_DEFAULT_MODE) && !empty(XLOCK_DEFAULT_MODE)
	cd ${WRKSRC}/xlock;						\
	${MV} -f XLock.ad XLock.ad.presed;				\
	${SED} -e "s|^\(XLock.mode:[ 	]*\).*|\1${XLOCK_DEFAULT_MODE}|" \
		XLock.ad.presed > XLock.ad;				\
	${RM} -f XLock.ad.presed
.endif

post-install:
	${INSTALL_DATA_DIR} ${DESTDIR}${XLOCK_SOUNDDIR}
	cd ${WRKSRC}/sounds;						\
	for file in *.au; do						\
		${INSTALL_DATA} $$file ${DESTDIR}${XLOCK_SOUNDDIR};	\
	done
	${INSTALL_DATA} ${FILESDIR}/pam-xlock-NetBSD \
	    ${DESTDIR}${EGDIR}/pam.d/xlock-NetBSD