1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-24 00:45:52 +00:00

* Enable assembly language optimizations on amd64.

* Use system byte-swapping functions.

PR:		139205, 139206
Submitted by:	swell.k@gmail.com  (idea)
Feature safe:	yes
This commit is contained in:
Christian Weisgerber 2009-10-01 21:49:43 +00:00
parent 0b63789ce5
commit c756d91684
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=242370
3 changed files with 93 additions and 2 deletions

View File

@ -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

View File

@ -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 <sys/param.h>
@@ -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 <sys/endian.h>
+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.

View File

@ -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 <byteswap.h>
#endif
+#ifdef HAVE_SYS_ENDIAN_H
+# include <sys/endian.h>
+#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