Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 May 2006 15:57:29 -0300 (BRST)
From:      Rainer Alves <rainer.alves@gmail.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        vd@FreeBSD.org, solar@openwall.com
Subject:   ports/96991: [MAINTAINER] security/john : respect CFLAGS & fix MMX detection logic 
Message-ID:  <200605081857.k48IvTpH066751@valfenda.ibest.com.br>
Resent-Message-ID: <200605081900.k48J0Ue1006910@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         96991
>Category:       ports
>Synopsis:       [MAINTAINER] security/john : respect CFLAGS & fix MMX detection logic
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 08 19:00:30 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Rainer Alves
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
BrasilTelecom

>Environment:
>Description:


- Define custom paths using CFLAGS instead of patching the source. [1]
- Fix MMX detection logic.

Requested by:	author <solar at openwall dot com> [1]


>How-To-Repeat:
>Fix:

--- john-fix.diff begins here ---
diff -ruN /usr/ports/security/john/Makefile security/john/Makefile
--- /usr/ports/security/john/Makefile	Thu May  4 10:25:49 2006
+++ security/john/Makefile	Mon May  8 15:19:35 2006
@@ -7,6 +7,7 @@
 
 PORTNAME=	john
 PORTVERSION=	1.7.0.2
+PORTREVISION=	1
 CATEGORIES=	security
 MASTER_SITES=	http://www.openwall.com/john/f/ \
 		ftp://ftp.ru.openwall.com/pub/projects/john/${PORTVERSION}/
@@ -24,24 +25,32 @@
 .include <bsd.port.pre.mk>
 
 OSNAME=		${OPSYS:L}
+CFLAGS+=	-DJOHN_SYSTEMWIDE=1 \
+		-DJOHN_SYSTEMWIDE_HOME=\\"${DATADIR}\\" \
+		-DCFG_FULL_NAME=\\"${PREFIX}/etc/${PORTNAME}.conf\\"
 
 ALL_TARGET=	generic
 .if ${ARCH} == "i386"
-. if ${MACHINE_CPU:Mmmx}
-ALL_TARGET=	${OSNAME}-x86-mmx
-. else
+. if defined(WITHOUT_MMX)
 ALL_TARGET=	${OSNAME}-x86-any
+. else
+ALL_TARGET=	${OSNAME}-x86-mmx
 . endif
 .elif ${ARCH} == "alpha"
 ALL_TARGET=	${OSNAME}-alpha
 .endif
 
+pre-everything::
+.if !defined(WITHOUT_MMX)
+	@${ECHO_MSG}
+	@${ECHO_MSG} "You can disable MMX optimizations by defining WITHOUT_MMX"
+	@${ECHO_MSG}
+.endif
+
 post-patch:
-	${REINPLACE_CMD} -e 's|$$JOHN|${DATADIR}|g' \
-		${WRKDIR}/${DISTNAME}/run/john.conf
-	${REINPLACE_CMD} -e \
-		's|%%PREFIX%%|${PREFIX}|g; s|%%DATADIR%%|${DATADIR}|g'\
-			${WRKSRC}/params.h
+	${REINPLACE_CMD} -e 's|= gcc|= ${CC}|g' \
+		-e 's|CFLAGS =.*|CFLAGS = -c ${CFLAGS}|g' \
+		${WRKSRC}/Makefile
 
 pre-build:
 	@${ECHO} "Building for ${ALL_TARGET}"
diff -ruN /usr/ports/security/john/files/patch-Makefile security/john/files/patch-Makefile
--- /usr/ports/security/john/files/patch-Makefile	Sat Dec 31 14:55:48 2005
+++ security/john/files/patch-Makefile	Wed Dec 31 21:00:00 1969
@@ -1,27 +0,0 @@
---- Makefile.orig	Mon Dec 12 19:53:36 2005
-+++ Makefile	Sat Dec 31 01:30:01 2005
-@@ -3,10 +3,10 @@
- # Copyright (c) 1996-2005 by Solar Designer
- #
- 
--CPP = gcc
--CC = gcc
--AS = gcc
--LD = gcc
-+CC ?= gcc
-+CPP = $(CC)
-+AS = $(CC)
-+LD = $(CC)
- CP = cp
- LN = ln -sf
- RM = rm -f
-@@ -15,7 +15,8 @@
- PERL = perl
- NULL = /dev/null
- CPPFLAGS = -E
--CFLAGS = -c -Wall -O2 -fomit-frame-pointer
-+CFLAGS ?= -O2
-+CFLAGS += -c -Wall -fomit-frame-pointer
- ASFLAGS = -c
- LDFLAGS = -s
- OPT_NORMAL = -funroll-loops
diff -ruN /usr/ports/security/john/files/patch-params.h security/john/files/patch-params.h
--- /usr/ports/security/john/files/patch-params.h	Thu May  4 10:25:50 2006
+++ security/john/files/patch-params.h	Mon May  8 15:17:49 2006
@@ -1,41 +1,14 @@
---- params.h.orig	Sun Mar 19 20:34:15 2006
-+++ params.h	Wed May  3 14:45:51 2006
-@@ -49,15 +49,15 @@
-  * notes above.
-  */
- #ifndef JOHN_SYSTEMWIDE
--#define JOHN_SYSTEMWIDE			0
-+#define JOHN_SYSTEMWIDE			1
- #endif
- 
- #if JOHN_SYSTEMWIDE
- #ifndef JOHN_SYSTEMWIDE_EXEC /* please refer to the notes above */
--#define JOHN_SYSTEMWIDE_EXEC		"/usr/libexec/john"
-+#define JOHN_SYSTEMWIDE_EXEC		"%%PREFIX%%/bin/john"
- #endif
- #ifndef JOHN_SYSTEMWIDE_HOME
--#define JOHN_SYSTEMWIDE_HOME		"/usr/share/john"
-+#define JOHN_SYSTEMWIDE_HOME		"%%DATADIR%%"
- #endif
- #define JOHN_PRIVATE_HOME		"~/.john"
- #endif
-@@ -101,8 +101,8 @@
+--- params.h.orig	Mon May  8 15:14:13 2006
++++ params.h	Mon May  8 15:16:41 2006
+@@ -101,7 +101,11 @@
  /*
   * File names.
   */
--#define CFG_FULL_NAME			"$JOHN/john.conf"
--#define CFG_ALT_NAME			"$JOHN/john.ini"
-+#define CFG_FULL_NAME			"%%PREFIX%%/etc/john.conf"
-+#define CFG_ALT_NAME			"%%PREFIX%%/etc/john.ini"
++#if JOHN_SYSTEMWIDE
++#ifndef CFG_FULL_NAME
+ #define CFG_FULL_NAME			"$JOHN/john.conf"
++#endif
++#endif
+ #define CFG_ALT_NAME			"$JOHN/john.ini"
  #if JOHN_SYSTEMWIDE
  #define CFG_PRIVATE_FULL_NAME		JOHN_PRIVATE_HOME "/john.conf"
- #define CFG_PRIVATE_ALT_NAME		JOHN_PRIVATE_HOME "/john.ini"
-@@ -116,7 +116,7 @@
- #endif
- #define LOG_SUFFIX			".log"
- #define RECOVERY_SUFFIX			".rec"
--#define WORDLIST_NAME			"$JOHN/password.lst"
-+#define WORDLIST_NAME			"%%DATADIR%%/password.lst"
- 
- /*
-  * Configuration file section names.
--- john-fix.diff ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605081857.k48IvTpH066751>