From c756d91684321bcbc358d98c16c759dab636b110 Mon Sep 17 00:00:00 2001 From: Christian Weisgerber Date: Thu, 1 Oct 2009 21:49:43 +0000 Subject: [PATCH] * Enable assembly language optimizations on amd64. * Use system byte-swapping functions. PR: 139205, 139206 Submitted by: swell.k@gmail.com (idea) Feature safe: yes --- archivers/xz/Makefile | 12 +++++- archivers/xz/files/patch-configure.ac | 37 +++++++++++++++++ archivers/xz/files/patch-src_common_bswap.h | 46 +++++++++++++++++++++ 3 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 archivers/xz/files/patch-configure.ac create mode 100644 archivers/xz/files/patch-src_common_bswap.h diff --git a/archivers/xz/Makefile b/archivers/xz/Makefile index 69de483fc6e5..a85c028d9ba6 100644 --- a/archivers/xz/Makefile +++ b/archivers/xz/Makefile @@ -7,6 +7,7 @@ PORTNAME= xz PORTVERSION= 4.999.9 +PORTREVISION= 1 CATEGORIES= archivers MASTER_SITES= http://tukaani.org/xz/ DISTNAME= ${PORTNAME}-${PORTVERSION}beta @@ -16,14 +17,17 @@ COMMENT= LZMA compression and decompression tools CONFLICTS= lzma-[0-9]* lzmautils-[0-9]* lzmalib-[0-9]* -USE_LDCONFIG= yes -GNU_CONFIGURE= yes MAKE_JOBS_SAFE= yes +USE_AUTOTOOLS= autoheader:262 autoconf:262 +USE_LDCONFIG= yes USE_GNOME= gnomehack CONFIGURE_ARGS= --enable-dynamic=yes CONFIGURE_ARGS+=--disable-nls # no translations available +# pick up assembly language optimizations +CONFIGURE_TARGET= ${ARCH:S/amd64/x86_64/}-portbld-freebsd${OSREL} + .if !defined(NOPORTDOCS) INSTALL_TARGET= install install-dist_docDATA .endif @@ -42,6 +46,10 @@ MLINKS= xz.1 lzcat.1 xzdiff.1 lzcmp.1 \ PORTDOCS= AUTHORS COPYING COPYING.GPLv2 NEWS README THANKS TODO \ faq.txt history.txt lzma-file-format.txt xz-file-format.txt +# no need to (attempt to) run aclocal +pre-build: + @touch -r ${WRKSRC}/configure.ac ${WRKSRC}/aclocal.m4 + regression-test: build @cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} check diff --git a/archivers/xz/files/patch-configure.ac b/archivers/xz/files/patch-configure.ac new file mode 100644 index 000000000000..f0efb5e60b9f --- /dev/null +++ b/archivers/xz/files/patch-configure.ac @@ -0,0 +1,37 @@ +--- configure.ac.orig 2009-08-27 17:37:12.000000000 +0200 ++++ configure.ac 2009-09-29 20:32:39.000000000 +0200 +@@ -476,7 +476,7 @@ AC_CHECK_HEADERS([fcntl.h limits.h sys/t + [AC_MSG_ERROR([Required header file(s) are missing.])]) + + # If any of these headers are missing, things should still work correctly: +-AC_CHECK_HEADERS([sys/param.h sys/sysctl.h byteswap.h], ++AC_CHECK_HEADERS([sys/param.h sys/sysctl.h byteswap.h sys/endian.h], + [], [], [ + #ifdef HAVE_SYS_PARAM_H + # include +@@ -504,6 +504,25 @@ main(void) + ])dnl + fi + ++if test x$ac_cv_header_sys_endian_h = xyes ; then ++ m4_foreach([FUNC], [bswap16,bswap32,bswap64], [ ++ AC_MSG_CHECKING([if FUNC is available]) ++ AC_LINK_IFELSE([AC_LANG_SOURCE([ ++#include ++int ++main(void) ++{ ++ FUNC[](42); ++ return 0; ++} ++ ])], [ ++ AC_DEFINE(HAVE_[]m4_toupper(FUNC), [1], ++ [Define to 1 if] FUNC [is available.]) ++ AC_MSG_RESULT([yes]) ++ ], [AC_MSG_RESULT([no])]) ++ ++ ])dnl ++fi + + ############################################################################### + # Checks for typedefs, structures, and compiler characteristics. diff --git a/archivers/xz/files/patch-src_common_bswap.h b/archivers/xz/files/patch-src_common_bswap.h new file mode 100644 index 000000000000..b12c98edc824 --- /dev/null +++ b/archivers/xz/files/patch-src_common_bswap.h @@ -0,0 +1,46 @@ +--- src/common/bswap.h.orig 2009-09-29 20:25:24.000000000 +0200 ++++ src/common/bswap.h 2009-09-29 20:27:50.000000000 +0200 +@@ -23,21 +23,35 @@ + #ifdef HAVE_BYTESWAP_H + # include + #endif ++#ifdef HAVE_SYS_ENDIAN_H ++# include ++#endif + + #ifndef HAVE_BSWAP_16 ++# ifdef HAVE_BSWAP16 ++# define bswap_16 bswap16 ++# else + # define bswap_16(num) \ + (((num) << 8) | ((num) >> 8)) ++# endif + #endif + + #ifndef HAVE_BSWAP_32 ++# ifdef HAVE_BSWAP32 ++# define bswap_32 bswap32 ++# else + # define bswap_32(num) \ + ( (((num) << 24) ) \ + | (((num) << 8) & UINT32_C(0x00FF0000)) \ + | (((num) >> 8) & UINT32_C(0x0000FF00)) \ + | (((num) >> 24) ) ) ++# endif + #endif + + #ifndef HAVE_BSWAP_64 ++# ifdef HAVE_BSWAP64 ++# define bswap_64 bswap64 ++# else + # define bswap_64(num) \ + ( (((num) << 56) ) \ + | (((num) << 40) & UINT64_C(0x00FF000000000000)) \ +@@ -47,6 +61,7 @@ + | (((num) >> 24) & UINT64_C(0x0000000000FF0000)) \ + | (((num) >> 40) & UINT64_C(0x000000000000FF00)) \ + | (((num) >> 56) ) ) ++# endif + #endif + + #endif