Mk/bsd.openssl.mk optimization

V.Chukharev chukharev at mail.ru
Fri Jul 25 17:13:12 UTC 2008


On Fri, 25 Jul 2008 16:09:10 +0300, V.Chukharev <chukharev at mail.ru> wrote:

> On Fri, 25 Jul 2008 07:30:18 +0300, Dirk Meyer <dirk.meyer at dinoex.sub.org> wrote:
>
>> So you are right that make index could be otimized,
>> but it will take much more work.
>
> Totally agree on this. I tryed to make caching in bsd.subdir.mk as Kris
> proposed, and I got also considerable speedup, but not as good as
> with the first patch. The grep on all packages is done once per port
> category. I miss how to pass the results to a child make...
>
> Anyway, I attach the new (better, but still not fully working) patch JFYI.

Well, I've found how to pass params to a child make. So the next version of the
patch comes at the end of this post.

This patch should work well for index builds, but I have big doubts about
all the rest. Please review and test if possible.

With the patch Mk/bsd.port.sudir.mk .include's Mk/bsd.openssl.mk, hence everywhere
when the former is used the latter is inderectly included. This is because I did not 
want to split the openssl staff into two parts. I put some protection.

>> kind regards Dirk
>>
>> - Dirk Meyer, Im Grund 4, 34317 Habichtswald, Germany
>> - [dirk.meyer at dinoex.sub.org],[dirk.meyer at guug.de],[dinoex at FreeBSD.org]
>> http://people.freebsd.org/~dinoex/errorlogs/
>>
>
>
> Best regards,

-- 
V. Chukharev


$ cat ~/Mk_bsd.openssl.mk_2.patch
--- /usr/ports/Mk/bsd.openssl.mk.orig	2008-07-23 09:14:29.000000000 +0300
+++ /usr/ports/Mk/bsd.openssl.mk	2008-07-25 16:06:16.000000000 +0300
@@ -33,6 +33,9 @@
# BUILD_DEPENDS		- are added if needed
# RUN_DEPENDS		- are added if needed

+.if !defined(BSD_OPENSSL_MK)
+BSD_OPENSSL_MK=yes
+
OpenSSL_Include_MAINTAINER=	dinoex at FreeBSD.org

# honor obsolete options for a bit
@@ -121,13 +124,19 @@
	exists(${DESTDIR}/${LOCALBASE}/lib/libcrypto.so)
# find installed port and use it for dependency
PKG_DBDIR?=		${DESTDIR}/var/db/pkg
+.if !defined(OPENSSL_INSTALLED)
OPENSSL_INSTALLED!=	grep -l -r "^lib/libssl.so." "${PKG_DBDIR}" | \
			while read contents; do \
				sslprefix=`grep "^@cwd " "$${contents}" | ${HEAD} -n 1`; \
				if test "$${sslprefix}" = "@cwd ${LOCALBASE}" ; then \
					echo "$${contents}"; break; fi; done
+.endif
+.if !defined(OPENSSL_PORT)
OPENSSL_PORT!=		grep "^@comment ORIGIN:" "${OPENSSL_INSTALLED}" | ${CUT} -d : -f 2
+.endif
+.if !defined(OPENSSL_SHLIBFILE)
OPENSSL_SHLIBFILE!=	grep "^lib/libssl.so." "${OPENSSL_INSTALLED}"
+.endif
OPENSSL_SHLIBVER?=	${OPENSSL_SHLIBFILE:E}
.endif
OPENSSL_PORT?=		security/openssl
@@ -168,3 +177,4 @@
### crypto
#RESTRICTED=		"Contains cryptography."

+.endif
--- /usr/ports/Mk/bsd.port.subdir.mk.orig	2008-07-21 16:00:36.000000000 +0300
+++ /usr/ports/Mk/bsd.port.subdir.mk	2008-07-25 16:06:16.000000000 +0300
@@ -56,6 +56,10 @@
DESCR?=			${PKGDIR}/pkg-descr

.include "${PORTSDIR}/Mk/bsd.commands.mk"
+#cache variables from bsd.openssl.mk
+.if !defined(BSD_OPENSSL_MK)
+.include "${PORTSDIR}/Mk/bsd.openssl.mk"
+.endif

.MAIN: all

@@ -374,6 +378,9 @@
	PKGINSTALLVER="${PKGINSTALLVER:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
	HAVE_COMPAT_IA32_KERN="${HAVE_COMPAT_IA32_KERN}" \
	CONFIGURE_MAX_CMD_LEN="${CONFIGURE_MAX_CMD_LEN}" \
+	OPENSSL_INSTALLED="${OPENSSL_INSTALLED}" \
+	OPENSSL_PORT="${OPENSSL_PORT}" \
+	OPENSSL_SHLIBFILE="${OPENSSL_SHLIBFILE}" \
	PYTHON_DEFAULT_VERSION="${PYTHON_DEFAULT_VERSION}" \
	PYTHON_DEFAULT_PORTVERSION="${PYTHON_DEFAULT_PORTVERSION}" \
	PYTHONBASE="${PYTHONBASE}" \



More information about the freebsd-ports mailing list