blob: a4e688b4b3791741d9082394805c5a9f92c97e80 (
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
61
62
63
64
65
|
include ../../Makefile.include PYTHONMODULE-PYCRYPTODOME-VERSION ../../download-files.include
DEPS= ../../Makefile.include Makefile PYTHONMODULE-PYCRYPTODOME-VERSION ../../download-files.include \
01-nosetuptool.patch 02-android-dlopen.patch \
03-obey-crosscompileflags.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
ifeq ($(TARGET_PLATFORM),appletvos)
# We cant export CFLAGS directly for tvos
# CFLAGS are added to linker command, having -bundle (LDSHARED) and -fembed_bitcode (CFLAGS)
# causes a failure: ld: -bundle and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together
export CC:=$(CC) $(CFLAGS)
else
export CC CFLAGS
endif
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
ifeq ($(OS),android)
cd $(PLATFORM); patch -p1 -i ../02-android-dlopen.patch
endif
cd $(PLATFORM); patch -p1 -i ../03-obey-crosscompileflags.patch
$(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)
touch $@
clean:
$(MAKE) -C $(PLATFORM) clean
rm -f .installed-$(PLATFORM)
distclean::
rm -rf $(PLATFORM) .installed-$(PLATFORM)
|