Bug 187441 - security/libgcrypt builds with generic MPI code instead of optimized assembler code
Summary: security/libgcrypt builds with generic MPI code instead of optimized assemble...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Tijl Coosemans
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-11 08:10 UTC by pr.FreeBSD.org
Modified: 2014-04-01 14:20 UTC (History)
0 users

See Also:


Attachments
file.diff (776 bytes, patch)
2014-03-11 08:10 UTC, pr.FreeBSD.org
no flags Details | Diff
libgcrypt.patch (4.49 KB, patch)
2014-03-16 16:16 UTC, Tijl Coosemans
no flags Details | Diff
libgcrypt.patch (4.53 KB, patch)
2014-03-16 16:57 UTC, Tijl Coosemans
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description pr.FreeBSD.org 2014-03-11 08:10:00 UTC
security/libgcrypt builds with generic C code instead of optimized assembler code.

Fix: configure script uses a helper script to decide which MPI code to use. That script is mpi/config.links.

The problem is that configure script detects that host x86_64-unknown-freebsdX while FreeBSD port systems sets the 'build' type to amd64-portbld-freebsdX.

In mpi/config.links there is a section for x86_64-*-* but there is nothing about amd64-*-*. 

IMHO the easiest way to fix this is to patch mpi/config.links by adding amd64-*-* section same as x86_64-*-* section. Attached file does that for libgcrypt 1.5.3.

Patch attached with submission follows:
How-To-Repeat: In /usr/ports/security/libgcrypt do:
make configure
Towards the end you will see:
config.status: linking mpi/generic/mpih-add1.c to mpi/mpih-add1.c
config.status: linking mpi/generic/mpih-sub1.c to mpi/mpih-sub1.c
config.status: linking mpi/generic/mpih-mul1.c to mpi/mpih-mul1.c
config.status: linking mpi/generic/mpih-mul2.c to mpi/mpih-mul2.c
config.status: linking mpi/generic/mpih-mul3.c to mpi/mpih-mul3.c
config.status: linking mpi/generic/mpih-lshift.c to mpi/mpih-lshift.c
config.status: linking mpi/generic/mpih-rshift.c to mpi/mpih-rshift.c
config.status: linking mpi/generic/mpi-asm-defs.h to mpi/mpi-asm-defs.h


For amd64 architecture the lines above should look like this:
config.status: linking mpi/amd64/mpih-add1.S to mpi/mpih-add1-asm.S
config.status: linking mpi/amd64/mpih-sub1.S to mpi/mpih-sub1-asm.S
config.status: linking mpi/amd64/mpih-mul1.S to mpi/mpih-mul1-asm.S
config.status: linking mpi/amd64/mpih-mul2.S to mpi/mpih-mul2-asm.S
config.status: linking mpi/amd64/mpih-mul3.S to mpi/mpih-mul3-asm.S
config.status: linking mpi/amd64/mpih-lshift.S to mpi/mpih-lshift-asm.S
config.status: linking mpi/amd64/mpih-rshift.S to mpi/mpih-rshift-asm.S
config.status: linking mpi/amd64/mpi-asm-defs.h to mpi/mpi-asm-defs.h
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2014-03-11 08:10:07 UTC
Maintainer of security/libgcrypt,

Please note that PR ports/187441 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/187441

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2014-03-11 08:10:08 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 Hirohisa Yamaguchi 2014-03-16 01:21:35 UTC
Hi,

The patch looks fine, I approve it.

At Tue, 11 Mar 2014 08:10:07 UT,
Edwin Groothuis wrote:
> Maintainer of security/libgcrypt,
>
> Please note that PR ports/187441 has just been submitted.

Regards,
-- 

	Hirohisa Yamaguchi
	  umq@ueo.co.jp
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2014-03-16 02:17:22 UTC
State Changed
From-To: feedback->open

Maintainer approved.
Comment 5 Tijl Coosemans freebsd_committer freebsd_triage 2014-03-16 12:54:30 UTC
Responsible Changed
From-To: freebsd-ports-bugs->tijl

Take.
Comment 6 Tijl Coosemans freebsd_committer freebsd_triage 2014-03-16 16:16:21 UTC
Hi,

Can you review and approve this new patch for ports/187441?  It contains
the following additional changes:

- Convert USE_AUTOTOOLS=libtool to USES=libtool.
- Convert USE_BZIP2=yes to USES=tar:bzip2.
- Add asm support for FreeBSD/i386 10.x (up to 99.x).
- Remove patching of ltmain.sh.  This was non-functional because of
  USE_AUTOTOOLS=libtool and is no longer needed.
Comment 7 Tijl Coosemans freebsd_committer freebsd_triage 2014-03-16 16:32:44 UTC
On Sun, 16 Mar 2014 17:16:21 +0100 Tijl Coosemans wrote:
> Can you review and approve this new patch for ports/187441?  It contains
> the following additional changes:
> 
> - Convert USE_AUTOTOOLS=libtool to USES=libtool.
> - Convert USE_BZIP2=yes to USES=tar:bzip2.
> - Add asm support for FreeBSD/i386 10.x (up to 99.x).
> - Remove patching of ltmain.sh.  This was non-functional because of
>   USE_AUTOTOOLS=libtool and is no longer needed.

Redports results: https://redports.org/buildarchive/20140316140100-12166/
Comment 8 Tijl Coosemans freebsd_committer freebsd_triage 2014-03-16 16:57:25 UTC
On Sun, 16 Mar 2014 17:32:44 +0100 Tijl Coosemans wrote:
> On Sun, 16 Mar 2014 17:16:21 +0100 Tijl Coosemans wrote:
>> Can you review and approve this new patch for ports/187441?  It contains
>> the following additional changes:
>> 
>> - Convert USE_AUTOTOOLS=libtool to USES=libtool.
>> - Convert USE_BZIP2=yes to USES=tar:bzip2.
>> - Add asm support for FreeBSD/i386 10.x (up to 99.x).
>> - Remove patching of ltmain.sh.  This was non-functional because of
>>   USE_AUTOTOOLS=libtool and is no longer needed.
> 
> Redports results: https://redports.org/buildarchive/20140316140100-12166/

This patch is a bit cleaner.  FreeBSD 1.x, 2.x and 3.x aren't supported
anyway.
Comment 9 dfilter service freebsd_committer freebsd_triage 2014-04-01 14:12:32 UTC
Author: tijl
Date: Tue Apr  1 13:12:28 2014
New Revision: 349852
URL: http://svnweb.freebsd.org/changeset/ports/349852
QAT: https://qat.redports.org/buildarchive/r349852/

Log:
  - USES=libtool tar:bzip2.
  - Enable asm on FreeBSD/i386 >= 10.0.
  - Enable asm on FreeBSD/amd64. [1]
  - Use MAKE_CMD instead of MAKE to run regression tests.
  
  PR:		ports/187441
  Submitted by:	Stoyan Dimov <pr.freebsd.org@registrations.systeem.com> [1]
  Approved by:	maintainer timeout (2 weeks)

Added:
  head/security/libgcrypt/files/patch-mpi-config.links   (contents, props changed)
Deleted:
  head/security/libgcrypt/files/patch-ltmain.sh
Modified:
  head/security/libgcrypt/Makefile
  head/security/libgcrypt/pkg-plist

Modified: head/security/libgcrypt/Makefile
==============================================================================
--- head/security/libgcrypt/Makefile	Tue Apr  1 13:02:31 2014	(r349851)
+++ head/security/libgcrypt/Makefile	Tue Apr  1 13:12:28 2014	(r349852)
@@ -3,6 +3,7 @@
 
 PORTNAME=	libgcrypt
 PORTVERSION=	1.5.3
+PORTREVISION=	1
 CATEGORIES=	security
 MASTER_SITES=	${MASTER_SITE_GNUPG}
 MASTER_SITE_SUBDIR=	${PORTNAME}
@@ -16,8 +17,7 @@ LICENSE_COMB=	multi
 BUILD_DEPENDS=	libgpg-error>=1.8:${PORTSDIR}/security/libgpg-error
 RUN_DEPENDS=	libgpg-error>=1.8:${PORTSDIR}/security/libgpg-error
 
-USE_BZIP2=	yes
-USE_AUTOTOOLS=	libtool
+USES=		libtool:oldver tar:bzip2
 USE_CSTD=	gnu89
 GNU_CONFIGURE=	yes
 CONFIGURE_ENV=	MAKEINFO="makeinfo --no-split"
@@ -28,7 +28,7 @@ DOCS=		AUTHORS ChangeLog ChangeLog-2011 
 INFO=		gcrypt
 PORTDOCS=	*
 
-.include <bsd.port.pre.mk>
+.include <bsd.port.options.mk>
 
 .if ${ARCH} == "powerpc"
 CONFIGURE_ARGS+=	--disable-asm
@@ -39,17 +39,10 @@ USE_GCC=	any
 .elif ${ARCH} == "i386"
 .if (${OSVERSION} < 900033)
 CONFIGURE_ARGS+=	--disable-aesni-support
-#workaround for FreeBSD 10.0
-.elif (${OSVERSION} >= 1000000)
-CONFIGURE_ARGS+=	--disable-asm
 .endif
 .endif
 
 post-patch:
-	@${REINPLACE_CMD} -e "s|%%PTHREAD_LIBS%%|${PTHREAD_LIBS}|" \
-		${WRKSRC}/ltmain.sh
-
-pre-configure:
 	@${RM} -f ${WRKSRC}/doc/gcrypt.info*
 
 .if ${PORT_OPTIONS:MDOCS}
@@ -59,6 +52,6 @@ post-install:
 .endif
 
 regression-test: build
-	cd ${WRKSRC} && ${MAKE} check
+	cd ${WRKSRC} && ${MAKE_CMD} check
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>

Added: head/security/libgcrypt/files/patch-mpi-config.links
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/security/libgcrypt/files/patch-mpi-config.links	Tue Apr  1 13:12:28 2014	(r349852)
@@ -0,0 +1,32 @@
+--- mpi/config.links.orig	2013-07-25 11:10:04.000000000 +0200
++++ mpi/config.links	2014-03-16 17:53:55.000000000 +0100
+@@ -46,9 +46,7 @@
+        path=""
+        ;;
+     i[3467]86*-*-openbsd*      | \
+-    i[3467]86*-*-freebsd*-elf  | \
+-    i[3467]86*-*-freebsd[3-9]* | \
+-    i[3467]86*-*-freebsdelf*   | \
++    i[3467]86*-*-freebsd*      | \
+     i[3467]86*-*-netbsd*       | \
+     i[3467]86*-*-k*bsd*)
+        echo '#define ELF_SYNTAX' >>./mpi/asm-syntax.h
+@@ -56,9 +54,7 @@
+        path="i386"
+        ;;
+     i586*-*-openbsd*         | \
+-    i586*-*-freebsd*-elf     | \
+-    i586*-*-freebsd[3-9]*    | \
+-    i586*-*-freebsdelf*      | \
++    i586*-*-freebsd*         | \
+     i586*-*-netbsd*	     | \
+     i586*-*-k*bsd*	     | \
+     pentium-*-netbsd*	     | \
+@@ -112,6 +108,7 @@
+ 	cat  $srcdir/mpi/i386/syntax.h	    >>./mpi/asm-syntax.h
+ 	path="i586 i386"
+ 	;;
++    amd64-*-* | \
+     x86_64-*-*)
+ 	echo '#define ELF_SYNTAX' >>./mpi/asm-syntax.h
+ 	cat  $srcdir/mpi/i386/syntax.h	    >>./mpi/asm-syntax.h

Modified: head/security/libgcrypt/pkg-plist
==============================================================================
--- head/security/libgcrypt/pkg-plist	Tue Apr  1 13:02:31 2014	(r349851)
+++ head/security/libgcrypt/pkg-plist	Tue Apr  1 13:12:28 2014	(r349852)
@@ -3,7 +3,6 @@ bin/hmac256
 bin/libgcrypt-config
 include/gcrypt.h
 include/gcrypt-module.h
-lib/libgcrypt.a
 lib/libgcrypt.la
 lib/libgcrypt.so
 lib/libgcrypt.so.19
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 10 Tijl Coosemans freebsd_committer freebsd_triage 2014-04-01 14:12:45 UTC
State Changed
From-To: open->closed

Committed in r349852.