Package: john
Version: 1.9.0-2
Followup-For: Bug #744843
Tags: patch

Dear maintainer!
I've developed a patch that allows the package to generate fallback
binaries during the building process. Could you kindly review and
incorporate this update?
diff --git a/debian/rules b/debian/rules
index 455a0b9..acfb6ab 100755
--- a/debian/rules
+++ b/debian/rules
@@ -42,6 +42,8 @@ else ifeq ($(CPU),i386)
        CFLAGS += -DCPU_FALLBACK
 else ifeq ($(CPU),amd64)
        TARGET := $(OS)-x86-64
+       # enabling amd64 fallbacks
+       CFLAGS += -DCPU_FALLBACK
 else ifeq ($(CPU),powerpc)
        TARGET := linux-ppc32
 else ifeq ($(CPU),ppc64)
@@ -74,17 +76,13 @@ else
        CFLAGS += -DCFG_FULL_NAME=\\\"/etc/john/john.conf\\\"
 endif
 
-# testing i386 for mmx instructions and sse2 extensions
 ifeq ($(CPU),i386)
        ifneq ($(OS),hurd)
-               MMX := $(shell grep -c '^flags.* mmx' /proc/cpuinfo)
-               ifneq ($(MMX),0)
-                       HAVEMMX := 1
-               endif
-               SSE := $(shell grep -c '^flags.* sse2' /proc/cpuinfo)
-               ifneq ($(SSE),0)
-                       HAVESSE := 1
-               endif
+               I386_FALLBACK := 1
+       endif
+else ifeq ($(CPU),amd64)
+       ifneq ($(OS),hurd)
+               X86_64_FALLBACK := 1
        endif
 endif
 
@@ -94,17 +92,20 @@ endif
 override_dh_auto_build:
        # building the selected target
        dh_auto_build -- clean $(TARGET)
-ifeq ($(HAVEMMX),1)
-       # renaming the non-mmx binary
+ifeq ($(I386_FALLBACK),1)
        mv run/john run/john-non-mmx
-       # building i386-mmx optimized binary
        dh_auto_build -- clean $(OS)-x86-mmx
-endif
-ifeq ($(HAVESSE),1)
-       # renaming the non-sse2 binary
        mv run/john run/john-non-sse
-       # building i386-sse2 optimized binary
        dh_auto_build -- clean $(OS)-x86-sse2
+else ifeq ($(X86_64_FALLBACK),1)
+       mv run/john run/john-non-avx
+       dh_auto_build -- clean $(OS)-x86-64-avx
+       mv run/john run/john-non-xop
+       dh_auto_build -- clean $(OS)-x86-64-xop
+       mv run/john run/john-non-avx2
+       dh_auto_build -- clean $(OS)-x86-64-avx2
+       mv run/john run/john-non-avx512
+       dh_auto_build -- clean $(OS)-x86-64-avx512
 endif
 
 override_dh_auto_install:
@@ -115,11 +116,14 @@ override_dh_auto_install:
        mv -f '{}'.utf8 '{}' \;
 
        # install fallbacks as needed
-ifeq ($(HAVEMMX),1)
+ifeq ($(I386_FALLBACK),1)
        dh_install run/john-non-mmx /usr/lib/john
-endif
-ifeq ($(HAVESSE),1)
        dh_install run/john-non-sse /usr/lib/john
+else ifeq ($(X86_64_FALLBACK),1)
+       dh_install run/john-non-avx /usr/lib/john
+       dh_install run/john-non-xop /usr/lib/john
+       dh_install run/john-non-avx2 /usr/lib/john
+       dh_install run/john-non-avx512 /usr/lib/john
 endif
 
 override_dh_auto_clean:

Reply via email to