summaryrefslogtreecommitdiff
path: root/net/samba/Makefile
blob: 95d80094502b7735b4a669aff928457ccaa3d0d5 (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
# $NetBSD: Makefile,v 1.46 2001/03/27 03:20:11 hubertf Exp $

DISTNAME=		samba-2.0.7-ja-1.3
PKGNAME=		samba-2.0.7.1.3
WRKSRC=			${WRKDIR}/${DISTNAME}/source
CATEGORIES=		net
MASTER_SITES=		ftp://ftp.samba.gr.jp/pub/samba-jp/samba-2.0.7-ja/

MAINTAINER=		packages@netbsd.org
HOMEPAGE=		http://www.samba.org/
COMMENT=		SMB/CIFS protocol server suite for UNIX

BUILD_DEPENDS+=		autoconf-2.13:../../devel/autoconf
BUILD_USES_MSGFMT=	yes

.if !exists(/usr/include/readline.h)
DEPENDS+=		readline>=4.0:../../devel/readline
.endif

CONFLICTS+=		samba-2.0.7-ja-*

USE_LIBINTL=		# defined
GNU_CONFIGURE=		# defined

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

SAMPLE_CONFIG=		${PREFIX}/share/examples/samba/smb.conf.sample
SAMBA_LOGDIR=		/var/log
SAMBA_LOCKDIR=		/var/run/samba
SAMBA_ETCDIR?=		/etc/samba
SAMBA_PRIVATE?=		${SAMBA_ETCDIR}/private

.if ${OPSYS} == "SunOS"
ROOT_GROUP?=		root
.else
ROOT_GROUP?=		wheel
.endif

MAKE_ENV+=		ETCDIR=${SAMBA_ETCDIR}
MAKE_ENV+=		LOGDIR=${SAMBA_LOGDIR}

CONFIGURE_ARGS+=	--with-lockdir=${SAMBA_LOCKDIR} \
			--with-privatedir=${SAMBA_PRIVATE} \
			--with-swatdir=${PREFIX}/share/swat \
			--with-i18n-swat \
			--with-sambabook=${PREFIX}/share/swat/using_samba

PLIST_SUBST+=		SAMBA_PRIVATE=${SAMBA_PRIVATE}

INSTALL_FILE=		${WRKDIR}/INSTALL
DEINSTALL_FILE=		${WRKDIR}/DEINSTALL

pre-configure:
	cd ${WRKSRC}; ${LOCALBASE}/bin/autoreconf

post-build:
.for FILE in nmbd.sh smbd.sh
	${SED}	-e "s,@PREFIX@,${PREFIX},g" \
		-e "s,@ECHO@,${ECHO},g" \
		< ${FILESDIR}/${FILE} > ${WRKDIR}/${FILE}
.endfor

post-install:
	# Install Samba documentation.
	#
	${INSTALL_DATA_DIR} ${PREFIX}/share/doc/samba
	${INSTALL_DATA_DIR} ${PREFIX}/share/doc/samba/faq
	${INSTALL_DATA_DIR} ${PREFIX}/share/doc/samba/textdocs
	cd ${WRKDIR}/${DISTNAME}/docs; \
	for file in \
	    NT4-Locking.reg NT4-Locking.txt NT4_PlainPassword.reg \
	    THANKS Win2000_PlainPassword.reg Win95_PlainPassword.reg \
	    Win98_PlainPassword.reg Win9X-CacheHandling.reg \
	    WindowsTerminalServer.reg announce; do \
		${INSTALL_DATA} $${file} ${PREFIX}/share/doc/samba; \
	done
	for file in ${WRKDIR}/${DISTNAME}/docs/faq/*.html; do \
		${INSTALL_DATA} $${file} ${PREFIX}/share/doc/samba/faq; \
	done
	for file in ${WRKDIR}/${DISTNAME}/docs/textdocs/*; do \
		${INSTALL_DATA} $${file} ${PREFIX}/share/doc/samba/textdocs; \
	done

	# Install Samba examples.
	#
	${INSTALL_DATA_DIR} ${PREFIX}/share/examples/samba
	${CP} -R ${WRKDIR}/${DISTNAME}/examples/* ${PREFIX}/share/examples/samba
	${CHOWN} -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/share/examples/samba
	${CHMOD} -R ugo-w ${PREFIX}/share/examples/samba

	${INSTALL_SCRIPT} ${WRKDIR}/nmbd.sh ${PREFIX}/etc/rc.d/nmbd
	${INSTALL_SCRIPT} ${WRKDIR}/smbd.sh ${PREFIX}/etc/rc.d/smbd

	${SED}	-e 's,@LOGDIR@,${SAMBA_LOGDIR},g' \
		-e 's,@ETCDIR@,${SAMBA_ETCDIR},g' \
		-e 's,@PREFIX@,{PREFIX},g' \
		< ${FILESDIR}/smb.conf.sample > ${WRKDIR}/smb.conf.sample
	${INSTALL_DATA} ${WRKDIR}/smb.conf.sample ${SAMPLE_CONFIG}
	${INSTALL_SCRIPT} ${WRKSRC}/script/mksmbpasswd.sh ${PREFIX}/bin

	${SED}	-e "s,@SAMBA_PRIVATE@,${SAMBA_PRIVATE},g" \
		-e "s,@ROOT_GROUP@,${ROOT_GROUP},g" \
		< ${PKGDIR}/INSTALL > ${INSTALL_FILE}
	${SED}	-e "s,@SAMBA_PRIVATE@,${SAMBA_PRIVATE},g" \
		< ${PKGDIR}/DEINSTALL > ${DEINSTALL_FILE}
	PKG_PREFIX=${PREFIX} ${SH} ${INSTALL_FILE} ${PKGNAME} POST-INSTALL

.include "../../mk/bsd.pkg.mk"