ports/132293: [PATCH] lang/ruby19: Add option to build with Profile-Guided Optimization
Mario Sergio Fujikawa Ferreira
lioux at FreeBSD.org
Wed Mar 4 00:10:03 UTC 2009
>Number: 132293
>Category: ports
>Synopsis: [PATCH] lang/ruby19: 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: Wed Mar 04 00:10:02 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Mario Sergio Fujikawa Ferreira
>Release: FreeBSD 7.1-STABLE i386
>Organization:
>Environment:
System: FreeBSD exxodus.fedaykin.here 7.1-STABLE FreeBSD 7.1-STABLE #57: Tue Feb 24 03:51:58 BRT 2009
>Description:
- Add WITH_PGO to build with Profile-Guided Optimization
- Add a validate target like the one from lang/ruby18/Makefile
Port maintainer (stas at FreeBSD.org) is cc'd.
Generated with FreeBSD Port Tools 0.77
>How-To-Repeat:
>Fix:
--- ruby-1.9.1.0_1,1.patch begins here ---
Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/lang/ruby19/Makefile,v
retrieving revision 1.4
diff -d -u -u -r1.4 Makefile
--- Makefile 9 Feb 2009 17:49:50 -0000 1.4
+++ Makefile 4 Mar 2009 00:04:35 -0000
@@ -42,7 +42,8 @@
NO_LATEST_LINK= yes
-OPTIONS= RDOC "Build and install Rdoc indexes" off \
+OPTIONS= PGO "Enable Profile-Guided Optimization" off \
+ RDOC "Build and install Rdoc indexes" off \
DEBUG "Compile-in debug info" off
.include <bsd.port.pre.mk>
@@ -75,8 +76,14 @@
CONFIGURE_ARGS+= --disable-install-doc
.endif
+.if defined(WITH_PGO)
+CONFIGURE_ENV= CFLAGS="${CFLAGS} -fprofile-generate" \
+ LDFLAGS="-fprofile-generate" \
+ LIBS="${LDFLAGS}"
+.else
CONFIGURE_ENV= CFLAGS="${CFLAGS}" \
LIBS="${LDFLAGS}"
+.endif
.if ${RUBY_VER} == ${RUBY_DEFAULT_VER}
MLINKS= ${RUBY_NAME}.1 ruby.1
@@ -133,6 +140,13 @@
${MV} ${BUILD_WRKSRC}/ext/${d} ${WRKDIR}/
.endfor
+.if defined(WITH_PGO)
+.if target(pre-build)
+.error Makefile error since pre-build target has already been defined
+.endif
+pre-build: pgo
+.endif
+
post-build:
#
# Hack to allow modules to be installed into separate PREFIX and/or under user
@@ -288,4 +302,42 @@
test:
@(cd ${WRKSRC}; ${MAKE} test)
+validate::
+ @(cd ${WRKSRC}; ${MAKE} update-rubyspec test-rubyspec)
+
+.if defined(WITH_PGO)
+pgo: pgo-pre-build pgo-build pgo-run pgo-post-run pgo-clean
+
+pgo-pre-build:
+ @${FIND} ${BUILD_WRKSRC} -type f -name Makefile -exec \
+ ${REINPLACE_CMD} -E \
+ -e 's,^(((C|LD)FLAGS|LDSHARED|ldflags)[[:space:]]*=.*)-fprofile-generate,\1,' \
+ -e 's,^(CFLAGS[[:space:]]*=.*)-fprofile-use,\1,' \
+ -e 's,^(((C|LD)FLAGS|LDSHARED|ldflags)[[:space:]]*=.*)$$,\1 -fprofile-generate,' \
+ {} \;
+
+pgo-build:
+ @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${ALL_TARGET})
+
+pgo-run:
+# Check everything to generate profiling information.
+# Everything runs so slowly that thread tests break on timing issues
+# so we will have to "trust" it just works during the profiling phase.
+ @-(cd ${BUILD_WRKSRC}; ${MAKE} test)
+
+pgo-post-run:
+ @${FIND} ${BUILD_WRKSRC} -type f -name Makefile -exec \
+ ${REINPLACE_CMD} -E \
+ -e 's,^(((C|LD)FLAGS|LDSHARED|ldflags)[[:space:]]*=.*)-fprofile-generate,\1,' \
+ -e 's,^(CFLAGS[[:space:]]*=.*)-fprofile-use,\1,' \
+ -e 's,^(CFLAGS[[:space:]]*=.*)$$,\1 -fprofile-use,' \
+ {} \;
+ @${REINPLACE_CMD} -E \
+ -e 's,-fprofile-generate,-fprofile-use,g' \
+ ${CONFIGURE_WRKSRC}/config.status
+
+pgo-clean:
+ @(cd ${BUILD_WRKSRC}; ${MAKE} clean)
+.endif # if defined(WITH_PGO)
+
.include <bsd.port.post.mk>
--- ruby-1.9.1.0_1,1.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list