Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

GNUmakefile 9.8 KB
Newer Older
1
# $Id: GNUmakefile,v 1.63 2020/05/02 08:24:08 deuce Exp $
2 3 4 5 6

SRC_ROOT = ../../src
# Cross platform/compiler definitions
include $(SRC_ROOT)/build/Common.gmake	# defines clean and output directory rules

7
JS_CONFIGURE_ARGS += $(EXTRA_JS_CONFIGURE_ARGS) --with-system-nspr --disable-tests --disable-shared-js --enable-threadsafe --prefix=$(shell echo `pwd`$(DIRSEP)$(JS_IDIR))
8
ifdef DEBUG
9
 JS_CONFIGURE_ARGS += --enable-debug-symbols --disable-optimize
10 11 12
else
 JS_CONFIGURE_ARGS += --enable-optimize=-O3
endif
13
CXXFLAGS = -std=gnu++98
14 15 16 17 18 19 20
ifeq ($(shell perl -e 'print "$(machine)"=~/\.arm/?"YES":"NO"'),YES)
 ifeq ($(shell perl -e 'print "$(machine)"=~/\.armv[1-6]/?"YES":"NO"'),YES)
  JS_CONFIGURE_ARGS += --with-cpu-arch=armv5te
 endif
 ifeq ($(shell perl -e 'print `gcc -v 2>&1`=~/--with-fpu=vfp/?"YES":"NO"'),YES)
  ifeq ($(shell perl -e 'print `gcc -v 2>&1`=~/--with-float=hard/?"YES":"NO"'),YES)
   JS_CONFIGURE_ENV += 'CFLAGS=-mfpu=vfp -mfloat-abi=hard'
21
   CXXFLAGS += -mfpu=vfp -mfloat-abi=hard
22 23 24
   JS_CONFIGURE_ENV += 'ASFLAGS=-mfpu=vfp -mfloat-abi=hard'
  else
   JS_CONFIGURE_ENV += 'CFLAGS=-msoft-float'
25
   CXXFLAGS += -msoft-float
26 27 28 29
   JS_CONFIGURE_ENV += 'ASFLAGS=-msoft-float'
  endif
 endif
endif
30 31 32 33 34 35 36 37 38 39 40
# OS/2 and "GNU" (HURD?) also need this, but we never plan to support them.
ifneq ($(os),darwin)
 ifneq ($(os),linux)
  ifneq ($(os),freebsd)
   ifneq ($(os),sunos)
    JS_CONFIGURE_ARGS += '--disable-tracejit'
   endif
  endif
 endif
endif

41
JS_CONFIGURE_ENV += 'CXXFLAGS=$(CXXFLAGS)'
42

43 44 45 46
.PHONY: cryptlib libmozjs
cryptlib: $(CRYPTLIB_BUILD)
libmozjs: $(JSLIB_BUILD)

47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
###############
# Directories #
###############
$(3RDPODIR):
	$(QUIET)$(IFNOTEXIST) mkdir $(3RDPODIR)

$(3RDPSRCDIR):
	$(QUIET)$(IFNOTEXIST) mkdir $(3RDPSRCDIR)

$(JS_SRC): | $(3RDPSRCDIR)
	$(QUIET)$(IFNOTEXIST) mkdir $(JS_SRC)

$(JS_IDIR): | $(3RDPODIR)
	$(QUIET)$(IFNOTEXIST) mkdir $(JS_IDIR)

62
$(JSLIB_BUILD): $(3RDP_ROOT)$(DIRSEP)dist/libmozjs.tgz $(3RDP_ROOT)$(DIRSEP)build/js_src_jsnativestack_cpp.patch $(3RDP_ROOT)$(DIRSEP)build/js-configure.patch $(3RDP_ROOT)$(DIRSEP)build/js-configure.in.patch $(3RDP_ROOT)$(DIRSEP)build/imacro-asm-fix.patch $(3RDP_ROOT)$(DIRSEP)build/js-volatile-outside-functions.patch $(3RDP_ROOT)$(DIRSEP)build/js-Wno-misleading-indentation.patch $(3RDP_ROOT)$(DIRSEP)build/js-allow-python3.patch | $(JS_SRC) $(JS_IDIR)
63
	@echo Creating $@ ...
64
	$(QUIET)-rm -rf $(JS_SRC)/*
65
	$(QUIET)tar -xzC $(JS_SRC) -f $(3RDPDISTDIR)$(DIRSEP)libmozjs.tgz
66
	$(QUIET)echo "pthread_np.h" >> $(JS_SRC)$(DIRSEP)js-1.8.5$(DIRSEP)js$(DIRSEP)src$(DIRSEP)config$(DIRSEP)system-headers
67 68 69
	$(QUIET)patch -b -p0 -d $(JS_SRC)$(DIRSEP)js-1.8.5 < js_src_jsnativestack_cpp.patch
	$(QUIET)patch -b -p0 -d $(JS_SRC) < js-configure.patch
	$(QUIET)patch -b -p0 -d $(JS_SRC) < js-configure.in.patch
70
	$(QUIET)patch -b -p0 -d $(JS_SRC) < imacro-asm-fix.patch
71
	$(QUIET)patch -b -p0 -d $(JS_SRC) < js-volatile-outside-functions.patch
72
	$(QUIET)patch -b -p0 -d $(JS_SRC) < js-Wno-misleading-indentation.patch
73
	$(QUIET)patch -b -p0 -d $(JS_SRC) < js-allow-python3.patch
74
	-$(QUIET)cd $(JS_SRC)$(DIRSEP)js-1.8.5$(DIRSEP)js$(DIRSEP)src && autoconf-2.13
75
	$(QUIET)cd $(JS_SRC)$(DIRSEP)js-1.8.5$(DIRSEP)js$(DIRSEP)src && env $(JS_CONFIGURE_ENV) ./configure $(JS_CONFIGURE_ARGS)
76 77 78 79 80 81 82 83 84
	$(QUIET)$(MAKE) -C $(JS_SRC)$(DIRSEP)js-1.8.5$(DIRSEP)js$(DIRSEP)src
	$(QUIET)$(MAKE) -C $(JS_SRC)$(DIRSEP)js-1.8.5$(DIRSEP)js$(DIRSEP)src install

$(CRYPT_SRC): | $(3RDPSRCDIR)
	$(QUIET)$(IFNOTEXIST) mkdir $(CRYPT_SRC)

$(CRYPT_IDIR): | $(3RDPODIR)
	$(QUIET)$(IFNOTEXIST) mkdir $(CRYPT_IDIR)

Synchronet's avatar
Synchronet committed
85
$(CRYPTLIB_BUILD): $(3RDP_ROOT)$(DIRSEP)dist/cryptlib.zip $(3RDP_ROOT)$(DIRSEP)build/terminal-params.patch $(3RDP_ROOT)$(DIRSEP)build/cl-mingw32-static.patch $(3RDP_ROOT)$(DIRSEP)build/cl-ranlib.patch $(3RDP_ROOT)$(DIRSEP)build/cl-win32-noasm.patch $(3RDP_ROOT)$(DIRSEP)build/cl-zz-country.patch $(3RDP_ROOT)$(DIRSEP)build/cl-algorithms.patch $(3RDP_ROOT)$(DIRSEP)build/cl-allow-duplicate-ext.patch $(3RDP_ROOT)$(DIRSEP)build/cl-macosx-minver.patch $(3RDP_ROOT)$(DIRSEP)build/cl-endian.patch $(3RDP_ROOT)$(DIRSEP)build/cl-cryptodev.patch $(3RDP_ROOT)$(DIRSEP)build/cl-posix-me-gently.patch $(3RDP_ROOT)$(DIRSEP)build/cl-tpm-linux.patch $(3RDP_ROOT)$(DIRSEP)build/cl-PAM-noprompts.patch $(3RDP_ROOT)$(DIRSEP)build/cl-zlib.patch $(3RDP_ROOT)$(DIRSEP)build/Dynamic-linked-static-lib.patch $(3RDP_ROOT)$(DIRSEP)build/SSL-fix.patch $(3RDP_ROOT)$(DIRSEP)build/cl-bigger-maxattribute.patch $(3RDP_ROOT)$(DIRSEP)build/cl-vcxproj.patch $(3RDP_ROOT)$(DIRSEP)build/cl-mingw-vcver.patch $(3RDP_ROOT)$(DIRSEP)build/cl-win32-build-fix.patch $(3RDP_ROOT)$(DIRSEP)build/cl-gcc-non-const-time-val.patch $(3RDP_ROOT)$(DIRSEP)build/cl-no-odbc.patch $(3RDP_ROOT)$(DIRSEP)build/cl-noasm-defines.patch $(3RDP_ROOT)$(DIRSEP)build/cl-bn-noasm64-fix.patch $(3RDP_ROOT)$(DIRSEP)build/cl-no-RSA-suites.patch $(3RDP_ROOT)$(DIRSEP)build/cl-fix-ECC-RSA.patch $(3RDP_ROOT)$(DIRSEP)build/cl-prefer-ECC.patch $(3RDP_ROOT)$(DIRSEP)build/cl-prefer-ECC-harder.patch $(3RDP_ROOT)$(DIRSEP)build/cl-more-RSA-ECC-fixes.patch $(3RDP_ROOT)$(DIRSEP)build/cl-DH-key-init.patch $(3RDP_ROOT)$(DIRSEP)build/cl-clear-GCM-flag.patch $(3RDP_ROOT)$(DIRSEP)build/cl-use-ssh-ctr.patch $(3RDP_ROOT)$(DIRSEP)build/cl-ssh-list-ctr-modes.patch $(3RDP_ROOT)$(DIRSEP)build/cl-ssh-incCtr.patch $(3RDP_ROOT)$(DIRSEP)build/cl-ssl-suite-blocksizes.patch $(3RDP_ROOT)$(DIRSEP)build/cl-no-tpm.patch $(3RDP_ROOT)$(DIRSEP)build/cl-no-via-aes.patch $(3RDP_ROOT)$(DIRSEP)build/cl-fix-ssh-ecc-ephemeral.patch $(3RDP_ROOT)$(DIRSEP)/build/cl-just-use-cc.patch $(3RDP_ROOT)$(DIRSEP)/build/cl-learn-numbers.patch $(3RDP_ROOT)$(DIRSEP)/build/cl-no-safe-stack.patch $(3RDP_ROOT)$(DIRSEP)/build/cl-allow-pkcs12.patch $(3RDP_ROOT)$(DIRSEP)/build/cl-uint64_t-redefine.patch $(3RDP_ROOT)$(DIRSEP)/build/cl-random-openbsd.patch $(3RDP_ROOT)$(DIRSEP)/build/cl-openbsd-threads.patch $(3RDP_ROOT)$(DIRSEP)/build/cl-allow-none-auth.patch $(3RDP_ROOT)$(DIRSEP)/build/cl-mingw-add-m32.patch $(3RDP_ROOT)$(DIRSEP)/build/cl-poll-not-select.patch $(3RDP_ROOT)$(DIRSEP)/build/cl-check-before-use.patch | $(CRYPT_SRC) $(CRYPT_IDIR)
86
	@echo Creating $@ ...
87
	$(QUIET)-rm -rf $(CRYPT_SRC)/*
88
	$(QUIET)unzip -oa $(3RDPDISTDIR)$(DIRSEP)cryptlib.zip -d $(CRYPT_SRC)
89
	$(QUIET)perl -pi.bak -e 's/\r//' $(CRYPT_SRC)/crypt32.vcxproj
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 124 125 126 127 128 129
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < terminal-params.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-mingw32-static.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-ranlib.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-vcxproj.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-endian.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-win32-noasm.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-zz-country.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-algorithms.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-allow-duplicate-ext.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-macosx-minver.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-cryptodev.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-posix-me-gently.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-tpm-linux.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-PAM-noprompts.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-zlib.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < Dynamic-linked-static-lib.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < SSL-fix.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-bigger-maxattribute.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-mingw-vcver.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-win32-build-fix.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-gcc-non-const-time-val.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-no-odbc.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-noasm-defines.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-bn-noasm64-fix.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-no-RSA-suites.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-fix-ECC-RSA.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-prefer-ECC.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-prefer-ECC-harder.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-more-RSA-ECC-fixes.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-DH-key-init.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-clear-GCM-flag.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-use-ssh-ctr.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-ssh-list-ctr-modes.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-ssh-incCtr.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-ssl-suite-blocksizes.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-no-tpm.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-no-via-aes.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-fix-ssh-ecc-ephemeral.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-just-use-cc.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-learn-numbers.patch
Deucе's avatar
Deucе committed
130
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-no-safe-stack.patch
Deucе's avatar
Deucе committed
131
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-allow-pkcs12.patch
132 133 134
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-uint64_t-redefine.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-random-openbsd.patch
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-openbsd-threads.patch
135
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-allow-none-auth.patch
Deucе's avatar
Deucе committed
136
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-mingw-add-m32.patch
137
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-poll-not-select.patch
Synchronet's avatar
Synchronet committed
138
	$(QUIET)patch -b -p0 -d $(CRYPT_SRC) < cl-check-before-use.patch
Deucе's avatar
Deucе committed
139
ifeq ($(os),win32)
140 141 142
	$(QUIET)cd $(CRYPT_SRC) && env - PATH="$(PATH)" CC="$(CC)" AR="$(AR)" RANLIB="$(RANLIB)" make directories
	$(QUIET)cd $(CRYPT_SRC) && env - PATH="$(PATH)" CC="$(CC)" AR="$(AR)" RANLIB="$(RANLIB)" make toolscripts
	$(QUIET)cd $(CRYPT_SRC) && env - PATH="$(PATH)" CC="$(CC)" AR="$(AR)" RANLIB="$(RANLIB)" make MINGW32_NT-6.1 OSNAME=win32
deuce's avatar
deuce committed
143 144
else
ifdef MINGW32
145
	$(QUIET)cd $(CRYPT_SRC) && env - PATH="$(PATH)" CC="$(CC)" AR="$(AR)" RANLIB="$(RANLIB)" make target-mingw
deuce's avatar
deuce committed
146
else
147
	$(QUIET)cd $(CRYPT_SRC) && env - PATH="$(PATH)" CC="$(CC)" AR="$(AR)" RANLIB="$(RANLIB)" make
deuce's avatar
deuce committed
148 149
endif
endif
150 151
	$(QUIET)cp $(CRYPT_SRC)$(DIRSEP)libcl.a $(CRYPT_IDIR)
	$(QUIET)cp $(CRYPT_SRC)$(DIRSEP)cryptlib.h $(CRYPT_IDIR)