1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# This has to be exported to make some magic below work.
export DH_OPTIONS
# This is for the target selection
CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
# This is to add missing hardening fortify functions export
CFLAGS += $(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS += -DJOHN_SYSTEMWIDE
# See src/params.h
ifeq ($(OS),kfreebsd)
# enabling crypt(3) for kfreebsd, there is a patch adding fmt_c3.o
CFLAGS += -DHAVE_CRYPT
LDFLAGS += -lcrypt
# as we will use $(OS)-x86-*, it must be named freebsd, not kfreebsd
OS := freebsd
endif
# arm FTBFS with -funroll-loops. Please see #476460
ifneq ($(CPU),arm)
CFLAGS += -funroll-loops
endif
# selecting compilation target
ifeq ($(OS),hurd)
TARGET := generic
else ifeq ($(CPU),i386)
# targeting an unoptimized binary first
TARGET := $(OS)-x86-any
# enabling i386 fallbacks
CFLAGS += -DCPU_FALLBACK
else ifeq ($(CPU),amd64)
TARGET := $(OS)-x86-64
else ifeq ($(CPU),powerpc)
TARGET := linux-ppc32
else ifeq ($(CPU),ppc64)
TARGET := linux-ppc64
else ifeq ($(CPU),alpha)
TARGET := linux-alpha
else ifeq ($(CPU),sparc)
TARGET := linux-sparc
else ifeq ($(CPU),ia64)
TARGET := linux-ia64
else
TARGET := generic
endif
# please take a look at:
# https://buildd.debian.org/status/logs.php?pkg=john&ver=1.7.7-1
ifeq ($(OS),freebsd)
# seems like freebsd targets don't like too much escaping
CFLAGS += -DJOHN_SYSTEMWIDE_EXEC=\"/usr/lib/john\"
CFLAGS += -DCFG_FULL_NAME=\"/etc/john/john.conf\"
else ifeq ($(TARGET),generic)
# and it is just the same for generic targets:
# armel, hurd-i386, mips, mipsel, and s390
CFLAGS += -DJOHN_SYSTEMWIDE_EXEC=\"/usr/lib/john\"
CFLAGS += -DCFG_FULL_NAME=\"/etc/john/john.conf\"
else
# but, we need a lot of escaping for:
# amd64, i386, ia64, powerpc, and sparc
CFLAGS += -DJOHN_SYSTEMWIDE_EXEC=\\\"/usr/lib/john\\\"
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
endif
endif
%:
dh $@ --sourcedirectory=src
override_dh_auto_build:
# building the selected target
dh_auto_build -- clean $(TARGET)
ifeq ($(HAVEMMX),1)
# renaming the non-mmx binary
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
endif
override_dh_auto_install:
# install the selected target
dh_auto_install
# install fallbacks as needed
ifeq ($(HAVEMMX),1)
dh_install run/john-non-mmx /usr/lib/john
endif
ifeq ($(HAVESSE),1)
dh_install run/john-non-sse /usr/lib/john
endif
override_dh_auto_clean:
dh_auto_clean
# script-not-executable
chmod +x debian/extra/cronjob
override_dh_auto_test:
|