Splitting up and simplifying devel/apr1

Tijl Coosemans tijl at FreeBSD.org
Sun Jun 23 18:48:18 UTC 2013


On 2013-06-22 12:50, olli hauer wrote:
>> In the discussion on src-committers about svnlite it was mentioned that
>> devel/subversion is too heavy to build, pulling in perl, python and
>> all the autotools. I've been going over its dependencies and it turns
>> out these are all pulled in by devel/apr1, so I've been looking into
>> simplifying that port.
>>
>> It seems the port can easily be split up into two simple ports, one for
>> the APR library and one for the APR Utility library. There's no need
>> for autotools, libtool, python, etc.
>>
>> I've attached a patch that creates devel/apr and devel/apr-util.
>> Please take a look at them and let me know what you think.
>> Another patch can then remove devel/apr1 and update all ports that
>> depend on it, but before I spend more time on this, do you agree this
> 
> On upstream apr and apr-util are already merged but until now are
> delivered separate.
> 
> In the past they had also sometimes update to apr2 snapshots where
> they delivered everything in one dist file.
> 
> In case there is no planning on upstream to merge the two distfiles
> into one like the apr2 snapshots then I think we could spend some
> time and separate the ports.
> 
> I will ask on the dev at apr.apache mailing list if there is a road map
> (I cannot find one on the apr public sites).

I've seen the mails on the apr mailing list. Since apr2 includes apr-util
it's probably easier to keep apr1 and apr-util in one port too. Then
there's no need to update and rebuild dependent ports either.

I've attached a new patch for devel/apr1. It contains the following changes:

- Move include <bsd.port.options.mk> down.
- Remove USE_AUTOTOOLS and USE_PYTHON_BUILD.
- Use pathfix to patch pkgconfig paths. (replaces a post-patch command)
- Add CFLAGS, CPPFLAGS and LDFLAGS to CONFIGURE_ENV. They are set for
  some options.
- Append include dirs to CPPFLAGS instead of CFLAGS.
- Remove files/patch-apr_hints.m4. Instead replace any evaluation of
  $os_version with ${OSVERSION} directly in configure script.
- Remove patching of gen-build.py because we don't run it anymore.
- Remove patching of "void main" to "int main". According to the commit log
  it was added for Clang, but Clang no longer seems to complain about it.
- Patch -lpthread directly in the configure script.
- Remove the run-autotools target. Running of configure has been moved to
  the do-configure target.
- Replace "cd <dir>; <command>" with "(cd <dir> && <command>)" as
  recommended by the make manpage in current.
- Add ${_MAKE_JOBS} in do-build.
- Rename the test target to regression-test because that's what pointyhat
  runs.
- Remove debug_autoconf target because we don't run autotools anymore.

-------------- next part --------------
Index: devel/apr1/Makefile
===================================================================
--- devel/apr1/Makefile	(revision 321639)
+++ devel/apr1/Makefile	(working copy)
@@ -29,18 +29,15 @@ NDBM_DESC=	NDBM support
 SSL_DESC=	OpenSSL crypto driver
 NSS_DESC=	NSS crypto driver
 
-.include <bsd.port.options.mk>
-
 APR_VERSION=	1.4.6
 APU_VERSION=	1.4.1
 
-USES=		iconv
-USE_AUTOTOOLS=	automake autoconf libtool:env
-USE_PYTHON_BUILD=	-2.7
-USE_LDCONFIG=		yes
-GNU_CONFIGURE=		yes
+USES=		iconv pathfix
+USE_LDCONFIG=	yes
+GNU_CONFIGURE=	yes
 
-CONFIGURE_ENV=	CC="${CC}"
+CONFIGURE_ENV=	CC="${CC}" CFLAGS="${CFLAGS}" CPPFLAGS="${CPPFLAGS}" \
+		LDFLAGS="${LDFLAGS}"
 
 NO_WRKSUBDIR=	yes
 APR_WRKDIR=	${WRKDIR}/apr-${APR_VERSION}
@@ -55,6 +52,8 @@ APU_CONF_ARGS=	--with-apr=${APR_WRKDIR} 
 		--with-expat=${LOCALBASE} \
 		--with-iconv=${LOCALBASE}
 
+.include <bsd.port.options.mk>
+
 ########## APR Options
 .if ${PORT_OPTIONS:MTHREADS}
 APR_CONF_ARGS+=	--enable-threads
@@ -131,7 +130,7 @@ PLIST_SUB+=	MYSQL=""
 USE_MYSQL=	YES
 APU_CONF_ARGS+=	--with-mysql=${LOCALBASE}
 CONFIGURE_ENV+=	LIBS="${LIBS}"
-CFLAGS+=	-I${LOCALBASE}/include -I${LOCALBASE}/include/mysql -DHAVE_MYSQL_H
+CPPFLAGS+=	-I${LOCALBASE}/include -I${LOCALBASE}/include/mysql -DHAVE_MYSQL_H
 LDFLAGS+=	-L${LOCALBASE}/lib/mysql
 .else
 PLIST_SUB+=	MYSQL="@comment "
@@ -168,7 +167,7 @@ APU_CONF_ARGS+=	--with-crypto
 APU_EXTRAS=	yes
 USE_OPENSSL=	yes
 PLIST_SUB+=	SSL=""
-CFLAGS+=	-I${OPENSSLINC}
+CPPFLAGS+=	-I${OPENSSLINC}
 LDFLAGS+=	-L${OPENSSLLIB}
 APU_CONF_ARGS+=	--with-openssl=${OPENSSLBASE}
 .else
@@ -182,7 +181,7 @@ APU_CONF_ARGS+=	--without-openssl
 APU_EXTRAS=	yes
 PLIST_SUB+=	NSS=""
 LIB_DEPENDS+=	nss3:${PORTSDIR}/security/nss
-CFLAGS+=	-I${LOCALBASE}/include/nss
+CPPFLAGS+=	-I${LOCALBASE}/include/nss
 LDFLAGS+=	-L${LOCALBASE}/lib/nss
 APU_CONF_ARGS+=	--with-nss=${LOCALBASE}
 .else
@@ -195,66 +194,31 @@ PLIST_SUB+=	APU_EXTRAS=""
 PLIST_SUB+=	APU_EXTRAS="@comment "
 .endif
 
-post-patch: .SILENT
-	${REINPLACE_CMD} -e 's/OSVERSION/${OSVERSION}/g' \
-		${APR_WRKDIR}/build/apr_hints.m4
-	${FIND} ${APR_WRKDIR} ${APU_WRKDIR} -name "Makefile.in*" | ${XARGS} ${REINPLACE_CMD} -e \
-		's|[(]libdir[)]/pkgconfig|(prefix)/libdata/pkgconfig|g'
-	${REINPLACE_CMD} -e '1 s/python/${PYTHON_VERSION}/' \
-		${APR_WRKDIR}/build/gen-build.py
-	${REINPLACE_CMD} -e 's/void main/int main/' ${APR_WRKDIR}/build/apr_network.m4
+post-patch:
+	@${REINPLACE_CMD} -e 's/$$os_version/${OSVERSION}/g' \
+		${APR_WRKDIR}/configure
 # Fix pthread: Please do not remove, else apr-1-config returns wrong values
-	${REINPLACE_CMD} -e 's/-lpthread/-pthread/g' \
-		${APR_WRKDIR}/build/apr_threads.m4 ${APR_WRKDIR}/build/apr_hints.m4 \
-		${APU_WRKDIR}/build/apu-conf.m4
-
-run-autotools::
-	cd ${APR_WRKDIR} ; \
-		${SETENV} ${CONFIGURE_ENV} ${SH} ./buildconf
-	cd ${APU_WRKDIR} ; \
-		${RM} -fr xml/expat
-	cd ${APU_WRKDIR} ; \
-		${SETENV} ${CONFIGURE_ENV} ${SH} ./buildconf \
-		--with-apr=${APR_WRKDIR}
-	${REINPLACE_CMD} -e 's/ gsed//g' \
-		${APR_WRKDIR}/build/libtool.m4 \
+	@${REINPLACE_CMD} -e 's/-lpthread/${PTHREAD_LIBS}/g' \
 		${APR_WRKDIR}/configure
-	cd ${APR_WRKDIR}; \
-		${SETENV} ${CONFIGURE_ENV} ${SH} \
-		./configure ${CONFIGURE_ARGS} ${APR_CONF_ARGS}
-	cd ${APU_WRKDIR}; \
-		${SETENV} ${CONFIGURE_ENV} CFLAGS="${CFLAGS}" ${SH} \
-		./configure ${CONFIGURE_ARGS} ${APU_CONF_ARGS}
 
 do-configure:
-	${DO_NADA}
+	@(cd ${APR_WRKDIR} && \
+		${SETENV} ${CONFIGURE_ENV} \
+		./configure ${CONFIGURE_ARGS} ${APR_CONF_ARGS})
+	@(cd ${APU_WRKDIR} && \
+		${SETENV} ${CONFIGURE_ENV} \
+		./configure ${CONFIGURE_ARGS} ${APU_CONF_ARGS})
 
 do-build:
-	cd ${APR_WRKDIR}; ${SETENV} ${MAKE_ENV} ${MAKE}
-	cd ${APU_WRKDIR}; ${SETENV} ${MAKE_ENV} ${MAKE}
+	@(cd ${APR_WRKDIR} && ${SETENV} ${MAKE_ENV} ${MAKE} ${_MAKE_JOBS})
+	@(cd ${APU_WRKDIR} && ${SETENV} ${MAKE_ENV} ${MAKE} ${_MAKE_JOBS})
 
 do-install:
-	cd ${APR_WRKDIR}; ${SETENV} ${MAKE_ENV} ${MAKE} ${INSTALL_TARGET}
-	cd ${APU_WRKDIR}; ${SETENV} ${MAKE_ENV} ${MAKE} ${INSTALL_TARGET}
+	@(cd ${APR_WRKDIR} && ${SETENV} ${MAKE_ENV} ${MAKE} ${INSTALL_TARGET})
+	@(cd ${APU_WRKDIR} && ${SETENV} ${MAKE_ENV} ${MAKE} ${INSTALL_TARGET})
 
-test: build
-	-@(cd ${APR_WRKDIR}; ${MAKE} test)
-	-@(cd ${APU_WRKDIR}; ${MAKE} test)
-
-#regression-test: test
-
-debug_autoconf:
-	@${ECHO} "LIBTOOL: ${LIBTOOL_VERSION}"
-	@${ECHO} "AUTOCONF: dev ${dev_acver} cur ${cur_acver} use ${use_acver}"
-	@${ECHO} "AUTOMAKE: dev ${dev_amver} cur ${cur_amver} use ${use_amver}"
-	@${ECHO} "AUTOCONF_DIR: ${AUTOCONF_DIR}"
-	@${ECHO} "BUILD_DEPENDS: ${BUILD_DEPENDS}"
-	@${ECHO} "ACLOCAL_DIR: ${ACLOCAL_DIR}"
-	@${ECHO} "LIBTOOLFILES: ${LIBTOOLFILES}"
-	@${ECHO} "LIBTOOL_SHAREDIR: ${LIBTOOL_SHAREDIR}"
-	@${ECHO} "LIBTOOL_LIBEXECDIR: ${LIBTOOL_LIBEXECDIR}"
-	@${ECHO} "LIBTOOL_M4: ${LIBTOOL_M4}"
-	@${ECHO} "${SETENV} ${CONFIGURE_ENV} ${SH} ./configure ${CONFIGURE_ARGS} ${APR_CONF_ARGS}"
-	@${ECHO} "${SETENV} ${CONFIGURE_ENV} CFLAGS="${CFLAGS}" ${SH} ./configure ${CONFIGURE_ARGS} ${APR_UTIL_CONF_ARGS}"
+regression-test: build
+	@(cd ${APR_WRKDIR} && ${SETENV} ${MAKE_ENV} ${MAKE} test)
+	@(cd ${APU_WRKDIR} && ${SETENV} ${MAKE_ENV} ${MAKE} test)
 
 .include <bsd.port.mk>
Index: devel/apr1/files/patch-apr_hints.m4
===================================================================
--- devel/apr1/files/patch-apr_hints.m4	(revision 321639)
+++ devel/apr1/files/patch-apr_hints.m4	(working copy)
@@ -1,15 +0,0 @@
---- apr-1.4.6/build/apr_hints.m4.orig	Wed Oct 27 11:12:28 2004
-+++ apr-1.4.6/build/apr_hints.m4	Wed Oct 27 11:25:32 2004
-@@ -159,11 +159,7 @@
- 	;;
-     *-freebsd*)
-         APR_SETIFNULL(apr_lock_method, [USE_FLOCK_SERIALIZE])
--        if test -x /sbin/sysctl; then
--            os_version=`/sbin/sysctl -n kern.osreldate`
--        else
--            os_version=000000
--        fi
-+        os_version="OSVERSION"
-         # 502102 is when libc_r switched to libpthread (aka libkse).
-         if test $os_version -ge "502102"; then
-           apr_cv_pthreads_cflags="none"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-apache/attachments/20130623/8ab79e21/attachment.sig>


More information about the freebsd-apache mailing list