blob: 6adbea17c85252c60dea289bc07449a4f6533304 (
plain)
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
|
include ../../Makefile.include PYTHONMODULE-PYCRYPTODOME-VERSION ../../download-files.include
DEPS= ../../Makefile.include Makefile PYTHONMODULE-PYCRYPTODOME-VERSION ../../download-files.include \
01-nosetuptool.patch \
02-revert-ctype.pythonapi-use.patch \
03-android-dlopen.patch
LDSHARED=$(CC) -shared
ifeq ($(OS),android)
LDFLAGS+= -L$(PREFIX)/lib/dummy-lib$(APP_NAME)/ -l$(APP_NAME) -lm
endif
ifeq (darwin, $(findstring darwin, $(HOST)))
ifeq ($(CPU),arm64)
# Work around an issue with xcode 11 stripping -arch arm64 flags.
# Not required for xcode 12+, but doesnt hurt either.
CFLAGS+= -target arm64-apple-darwin
LDFLAGS+= -target arm64-apple-darwin
endif
LDSHARED:=$(CC) -bundle -undefined dynamic_lookup $(LDFLAGS)
endif
export CC CFLAGS
export LDSHARED LDFLAGS
export PYTHONPATH=$(PYTHON_SITE_PKG)
LIBDYLIB=$(PLATFORM)/build/lib.$(OS)-$(CPU)-$(PYTHON_VERSION)/Cryptodome
ifeq ($(NATIVE_OS), osx)
# this module will always recompile. currently the hardcoded 10.4 is incorrect
# and would need to be generated based on sdk version that we dont currently collect
LIBDYLIB=$(PLATFORM)/build/lib.macosx-10.4-$(CPU)-$(PYTHON_VERSION)/Cryptodome
endif
all: .installed-$(PLATFORM)
$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE) $(DEPS)
rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
cd $(PLATFORM); patch -p1 -i ../01-nosetuptool.patch
cd $(PLATFORM); patch -p1 -i ../02-revert-ctype.pythonapi-use.patch
ifeq ($(OS),android)
cd $(PLATFORM); patch -p1 -i ../03-android-dlopen.patch
endif
$(LIBDYLIB): $(PLATFORM)
cd $(PLATFORM); touch .separate_namespace && $(NATIVEPREFIX)/bin/python3 setup.py build_ext --plat-name $(OS)-$(CPU)
.installed-$(PLATFORM): $(LIBDYLIB)
cd $(PLATFORM); $(NATIVEPREFIX)/bin/python3 setup.py install --prefix=$(PREFIX)
cd $(PYTHON_SITE_PKG); mkdir -p Cryptodome && cp -rf pycryptodomex*.egg/Cryptodome/* ./Cryptodome && rm -rf pycryptodomex*.egg
touch $@
clean:
$(MAKE) -C $(PLATFORM) clean
rm -f .installed-$(PLATFORM)
distclean::
rm -rf $(PLATFORM) .installed-$(PLATFORM)
|