Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Jul 2003 19:06:11 +0000
From:      "Gustavo A. Baratto" <gbaratto@superb.net>
To:        dominic.marks@btinternet.com, freebsd-ports@freebsd.org
Subject:   Makefile for apache 2 port
Message-ID:  <3F202E23.9040608@superb.net>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------000701010507040500060105
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Greetings,

I was trying to use the apache2 port for freebsd, and I didn't figure 
out how to select my own  modules and paths. I'm trying to write the 
Makefile so I can specify any path, and the how the modules should be 
built (shared, static and disabled).

Could this Makefile be improved? Or all the work I had was not necessary?

The module and path selection selection work fine, but I'm very new in 
this ports thing, and I'm having some difficulties building a plist 
"on-the-fly".

This could be used like this:
make PREFIX=/usr/local/apache2 SYSCONFIGDIR=/usr/local/etc/www 
DATADIR=/home/www SHARED_MODULES="proxy cgid" STATIC_MODULES="proxy-ftp 
proxy-http" DISABLE_MODULES="cgi nw_ssl cgid"

-- 
  --------------------------------------------------------------------------
  Gustavo Baratto - Programming and Technical Support
  GBaratto@SUPERB.NET * (604) 638-2525 ext. 408

  Technical support web-site: http://support.superb.net
  Superb Internet Corp. "Ahead of the Rest"
  -------------------------------------------------------------------------

--------------000701010507040500060105
Content-Type: text/plain;
 name="Makefile.apache.port.gustavo"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="Makefile.apache.port.gustavo"

# New ports collection makefile for:	apache2
# Date created:				7 April 2001
# Whom:					Hye-Shik Chang <perky@fallin.lv>
#
# $FreeBSD: ports/www/apache2/Makefile,v 1.148 2003/07/09 15:31:40 cy Exp $
#

PORTNAME=	apache
PORTVERSION=	2.0.47
CATEGORIES=	www ipv6
MASTER_SITES=	${MASTER_SITE_APACHE_HTTPD}
DISTNAME=	httpd-${PORTVERSION}
DISTFILES=	${DISTNAME}.tar.gz powerlogo.gif:freebsd
EXTRACT_ONLY=	${DISTNAME}.tar.gz

MAINTAINER?=	dominic.marks@btinternet.com
COMMENT?=	Version 2 of the extremely popular Apache http server

LIB_DEPENDS=	expat.4:${PORTSDIR}/textproc/expat2

LATEST_LINK=	apache2

WITH_MPM?=	prefork # or worker, perchild
HTTP_PORT?=	80

GNU_CONFIGURE=	yes
USE_PERL5=	yes
USE_REINPLACE=	yes


EXEC_PREFIX=${PREFIX_RELDEST}
BINDIR=${EXEC_PREFIX}/bin
SBINDIR=${EXEC_PREFIX}/sbin
LIBEXECDIR=${EXEC_PREFIX}/libexec/apache2
MANDIR=${PREFIX_RELDEST}/man
SYSCONFIGDIR=${PREFIX_RELDEST}/etc/apache2
DATADIR=${PREFIX_RELDEST}/www
INSTALLBUILDDIR=${PREFIX_RELDEST}/share/apache2/build
ERRORDIR=${DATADIR}/error
ICONSDIR=${DATADIR}/icons
HTDOCSDIR=${DATADIR}/data
MANUALDIR=${PREFIX_RELDEST}/share/doc/apache2
CGIDIR=${DATADIR}/cgi-bin
INCLUDEDIR=${PREFIX_RELDEST}/include/apache2
LOCALSTATEDIR=/var
RUNTIMEDIR=${LOCALSTATEDIR}/run
LOGFILEDIR=${LOCALSTATEDIR}/log
PROXYCACHEDIR=${DATADIR}/proxy
INFODIR=${EXEC_PREFIX}/share/info
STARTUPFILE=${PREFIX_RELDEST}/etc/rc.d/apache2.sh


SHARED_MODULES=all cgid deflate ext_filter proxy proxy-connect proxy-ftp proxy-http
STATIC_MODULES=  
DISABLE_MODULES= nw_ssl

APACHE-USER=www
APACHE-GROUP=www

CONFIGURE_ARGS= --prefix=${PREFIX_RELDEST} \
--enable-layout=FreeBSD \
--with-mpm=${WITH_MPM} \
--with-port=${HTTP_PORT} \
--with-expat=${LOCALBASE} \
--enable-modules="${STATIC_MODULES}" \
--enable-mods-shared="${SHARED_MODULES}"  


CONFIGURE_ENV=	CC="${CC}" CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" \
                LDFLAGS="${LDFLAGS}" CONFIG_SHELL="${SH}"
PREFIX_RELDEST=	${PREFIX:S,^${DESTDIR},,}
RC_SUB=         -e 's,@@PREFIX@@,${PREFIX_RELDEST},g'
MAKE_ENV+=      DESTDIR=${DESTDIR} EXPR_COMPAT=yes

.if defined(NOPORTDOCS)
MAKE_ENV+=	NOPORTDOCS=yes
.endif

.if !defined(IPV6_V6ONLY)
CONFIGURE_ARGS+= --enable-v4-mapped
.endif

#add extra options needed for some static modules
EXTRA_OPTIONS=${STATIC_MODULES} ${SHARED_MODULES} ${EXTRA_ARGS}
.for _EXTRA_OPTION in ${EXTRA_OPTIONS}
OPTION=${_EXTRA_OPTION}
.if ${OPTION} == ssl
    USE_OPENSSL= yes
    CONFIGURE_ARGS+= --with-ssl=${OPENSSLBASE}
    PLIST_SUB+= MODSSL=""
    RC_SUB+=       -e 's,@@SSL@@,ssl,g'

.elif (${OPTION} == "ldap") || (${OPTION} == "auth-ldap")
    LIB_DEPENDS+=   ldap.2:${PORTSDIR}/net/openldap21
    CONFIGURE_ARGS+= --with-ldap \
        --with-ldap-lib="${LOCALBASE}/lib" \
        --with-ldap-include="${LOCALBASE}/include"
    PLIST_SUB+=     LDAP=""

.elif (${OPTION} == "suexec")
    SUEXEC_DOCROOT?= ${HTDOCSDIR}
    SUEXEC_USERDIR?= public_html
    SUEXEC_SAFEPATH?=${BINDIR}:${LOCALBASE}/bin:/usr/bin:/bin
    CONFIGURE_ARGS+= --enable-suexec \
        --with-suexec-caller=${APACHE-USER} \
        --with-suexec-uidmin=1000 --with-suexec-gidmin=1000 \
        --with-suexec-userdir="${SUEXEC_USERDIR}" \
        --with-suexec-docroot="${SUEXEC_DOCROOT}" \
        --with-suexec-safepath="${SUEXEC_SAFEPATH}" \
        --with-suexec-logfile="${LOGFILEDIR}/httpd-suexec.log" \
        --with-suexec-bin="${SBINDIR}/suexec"
    PLIST_SUB+=     SUEXEC=""

.elif (${OPTION} == "XXXXX")
    LIB_DEPENDS+=   xxx.2:${PORTSDIR}/net/xxx
.endif
.endfor


#create a list of modules to be disabled (--disable-log --disable-XX)
DISABLE_LIST=
.for _DISABLE_MODULE in ${DISABLE_MODULES}
    DISABLE_LIST+= --disable-${_DISABLE_MODULE} 
.endfor

.include <bsd.port.pre.mk>


.if ${WITH_MPM} != "prefork"
PKGNAMESUFFIX=	-${WITH_MPM}
WITH_THREADS=	yes
.if ${WITH_MPM} == "worker"
PLIST_SUB+=	PREFORK="@comment " WORKER=""
.else
PLIST_SUB+=	PREFORK="@comment " WORKER="@comment "
.endif
.else
PLIST_SUB+=	PREFORK="" WORKER="@comment "
.endif

.if defined(WITH_THREADS)
CONFIGURE_ARGS+= --enable-threads
CFLAGS+=	-DFREEBSD_THREAD_HACK
SHARED_MODULES+= cache file-cache disk-cache mem_cache
PLIST_SUB+=	THREADS=""
.else
PLIST_SUB+=	THREADS="@comment "
.endif

.if defined(WITH_EXPERIMENTAL)
SHARED_MODULES+= bucketeer case_filter case_filter_in ext_filter charset_lite \
		optional_hook_export optional_hook_import \
		optional_fn_import optional_fn_export
PLIST_SUB+=	EXPERIMENTAL=""
.else
PLIST_SUB+=	EXPERIMENTAL="@comment "
.endif

#CONFIGURE_ARGS+= ${DISABLE_LIST} ${CONFIGURE_TARGET}
CONFIGURE_ARGS+= ${DISABLE_LIST}


MAN1=		dbmmanage.1 htdigest.1 htpasswd.1
MAN8=		ab.8 apachectl.8 apxs.8 httpd.8 logresolve.8 rotatelogs.8 suexec.8

post-extract:
	@${INSTALL_DATA} ${DISTDIR}/powerlogo.gif ${WRKSRC}/docs/icons/freebsd.gif
	echo ${EXTRA_OPTIONS}
	echo ${CONFIGURE_ARGS}

post-patch:
	@cd ${WRKSRC}/docs/docroot && \
	 for f in index.html.*; do (\
	  ${REINPLACE_CMD} -e 's,apache_pb,icons/freebsd.gif"\
		ALT="[Powered by FreeBSD]"><IMG SRC="apache_pb2_ani,g' $$f \
	 ); done
	@${RM} -f ${WRKSRC}/docs/docroot/*.bak
	@${SED} ${RC_SUB} ${FILESDIR}/apache.sh >${WRKDIR}/apache2.sh
	@${ECHO} "<Layout FreeBSD>" 			>> ${WRKSRC}/config.layout
	@${ECHO} "prefix: ${PREFIX_RELDEST}" 		>> ${WRKSRC}/config.layout
	@${ECHO} "exec_prefix: ${EXEC_PREFIX}"		>> ${WRKSRC}/config.layout
	@${ECHO} "bindir: ${BINDIR}"			>> ${WRKSRC}/config.layout
	@${ECHO} "sbindir: ${SBINDIR}"			>> ${WRKSRC}/config.layout
	@${ECHO} "libexecdir: ${LIBEXECDIR}"		>> ${WRKSRC}/config.layout
	@${ECHO} "mandir: ${MANDIR}"			>> ${WRKSRC}/config.layout
	@${ECHO} "sysconfdir: ${SYSCONFIGDIR}"		>> ${WRKSRC}/config.layout
	@${ECHO} "datadir: ${DATADIR}"			>> ${WRKSRC}/config.layout
	@${ECHO} "installbuilddir: ${INSTALLBUILDDIR}"	>> ${WRKSRC}/config.layout
	@${ECHO} "errordir: ${ERRORDIR}"		>> ${WRKSRC}/config.layout
	@${ECHO} "iconsdir: ${ICONSDIR}"		>> ${WRKSRC}/config.layout
	@${ECHO} "htdocsdir: ${HTDOCSDIR}"		>> ${WRKSRC}/config.layout
	@${ECHO} "manualdir: ${MANUALDIR}"		>> ${WRKSRC}/config.layout
	@${ECHO} "cgidir: ${CGIDIR}"			>> ${WRKSRC}/config.layout
	@${ECHO} "includedir: ${INCLUDEDIR}"		>> ${WRKSRC}/config.layout
	@${ECHO} "localstatedir: ${LOCALSTATEDIR}"	>> ${WRKSRC}/config.layout
	@${ECHO} "runtimedir: ${RUNTIMEDIR}"		>> ${WRKSRC}/config.layout
	@${ECHO} "logfiledir: ${LOGFILEDIR}"		>> ${WRKSRC}/config.layout
	@${ECHO} "proxycachedir: ${PROXYCACHEDIR}"	>> ${WRKSRC}/config.layout
	@${ECHO} "infodir: ${INFODIR}"			>> ${WRKSRC}/config.layout
	@${ECHO} "</Layout>" 				>> ${WRKSRC}/config.layout
	@${RM} -f ${WRKSRC}/docs/manual/index.html.ko.euc-kr

pre-install:
	PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL

post-install:
	@if [ ! -f ${PREFIX}/etc/rc.d/apache2.sh ]; then \
		${ECHO} "Installing ${PREFIX}/etc/rc.d/apache2.sh startup file."; \
		${INSTALL_SCRIPT} -m 751 ${WRKDIR}/apache2.sh ${PREFIX}/etc/rc.d/apache2.sh; \
	fi

.include <bsd.port.post.mk>

--------------000701010507040500060105--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F202E23.9040608>