ports/133356: [PATCH] mail/crm114: Add option to build with Profile-Guided Optimization
Mario Sergio Fujikawa Ferreira
lioux at FreeBSD.org
Sat Apr 4 04:20:04 UTC 2009
>Number: 133356
>Category: ports
>Synopsis: [PATCH] mail/crm114: Add option to build with Profile-Guided Optimization
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sat Apr 04 04:20:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Mario Sergio Fujikawa Ferreira
>Release: FreeBSD 7.2-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD exxodus.fedaykin.here 7.2-PRERELEASE FreeBSD 7.2-PRERELEASE #70: Sat Mar 21 09:29:39 BRT 2009
>Description:
- Add WITH_PGO to build with Profile-Guided Optimization
- Profile-Guided Optimization build support is off per default
Port maintainer (hideo at lastamericanempire.com) is cc'd.
Generated with FreeBSD Port Tools 0.77
- For information on Profile-Guided Optimization:
http://en.wikipedia.org/wiki/Profile-guided_optimization
------- RECIPE
1) Compile everything with CFLAGS/LDFLAGS containing
'-fprofile-generate';
2) Run lots of test cases to generate profiling information;
3) Remove all binaries leaving only the profiling information behind;
4) Replace all instances of '-fprofile-generate' with
'-fprofile-use';
5) Re-compile everything using the profiling information.
-------
>How-To-Repeat:
>Fix:
--- crm114-20080326_2.patch begins here ---
Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/mail/crm114/Makefile,v
retrieving revision 1.24
diff -d -u -u -r1.24 Makefile
--- Makefile 13 Feb 2009 17:10:59 -0000 1.24
+++ Makefile 4 Apr 2009 04:04:40 -0000
@@ -27,8 +27,8 @@
USE_GETTEXT= yes
USE_ICONV= yes
-MAKE_ARGS= CC="${CC}" CFLAGS="${CFLAGS}" prefix="${PREFIX}" \
- LDFLAGS="${LDFLAGS}" LIBS="${LIBS}" \
+MAKE_ARGS= CC="${CC}" prefix="${PREFIX}" \
+ LIBS="${LIBS}" \
INSTALL_PROGRAM="${INSTALL_PROGRAM}"
CFLAGS+= -I${LOCALBASE}/include
@@ -43,11 +43,30 @@
blacklist.mfp.example whitelist.mfp.example crm114-mode.el \
procmailrc.recipe
+OPTIONS= PGO "Enable Profile-Guided Optimization" off
+
+.include <bsd.port.pre.mk>
+
+.if defined(WITH_PGO)
+MAKE_ARGS+= CFLAGS="${CFLAGS} -fprofile-use" \
+ LDFLAGS="${LDFLAGS} -fprofile-use"
+.else
+MAKE_ARGS+= CFLAGS="${CFLAGS}" \
+ LDFLAGS="${LDFLAGS}"
+.endif
+
post-patch:
@${REINPLACE_CMD} -Ee \
's,^((LD|C)FLAGS),#\1,;;s,^(prefix=),#\1,;;s,^(.*-install),#\1,' \
${WRKSRC}/Makefile
+.if defined(WITH_PGO)
+.if target(pre-build)
+.error Makefile error since pre-build target has already been defined
+.endif
+pre-build: pgo
+.endif
+
# Peter Jeremy recommended the use of b64decode and md5 20040302
post-install:
@${REINPLACE_CMD} -Ee 's|^(.*/openssl base64 -d/)|#\1|' \
@@ -78,4 +97,19 @@
done
.endif
-.include <bsd.port.mk>
+.if defined(WITH_PGO)
+pgo: pgo-build pgo-run pgo-clean
+
+pgo-build:
+ @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} CFLAGS="${CFLAGS} -fprofile-generate" LDFLAGS="${LDFLAGS} -fprofile-generate" ${ALL_TARGET})
+
+pgo-run:
+# Check everything to generate profiling information.
+# We will ignore any errors.
+ @-(cd ${BUILD_WRKSRC}; ${MAKE} megatest)
+
+pgo-clean:
+ @(cd ${BUILD_WRKSRC}; ${MAKE} clean)
+.endif # if defined(WITH_PGO)
+
+.include <bsd.port.post.mk>
--- crm114-20080326_2.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list