forked from frida/frida
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.sdk.mk
150 lines (124 loc) · 3.42 KB
/
Makefile.sdk.mk
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
include config.mk
include releng/deps.mk
ifeq ($(FRIDA_V8), auto)
FRIDA_V8 := $(shell echo $(host_machine) | grep -Evq "^(windows-.+-mingw32|linux-mips|qnx-)" && echo "enabled" || echo "disabled")
endif
packages = \
zlib \
xz \
brotli \
minizip \
sqlite \
libffi \
pcre2 \
glib \
glib-networking \
ngtcp2 \
libnice \
lwip \
usrsctp \
libgee \
json-glib \
libxml2 \
libsoup \
capstone \
quickjs \
$(NULL)
ifeq ($(host_os), $(filter $(host_os), macos ios watchos tvos))
# Pull in iconv so our payloads only depend on libSystem.
glib_deps += libiconv
endif
ifeq ($(host_os), $(filter $(host_os), linux android qnx))
packages += elfutils libdwarf libunwind
endif
ifeq ($(host_os), freebsd)
packages += libdwarf libunwind
endif
ifeq ($(host_os), android)
packages += selinux
endif
ifneq ($(FRIDA_V8), disabled)
packages += v8
ifeq ($(host_os), $(filter $(host_os), macos ios watchos tvos))
ifeq ($(FRIDA_ASAN), no)
packages += libcxx
endif
endif
endif
ifeq ($(host_arch), $(filter $(host_arch), x86 x86_64 arm armbe8 armeabi armhf arm64 arm64e arm64eoabi))
packages += tinycc
endif
.PHONY: all clean distclean
all: build/sdk-$(host_machine).tar.bz2
@echo ""
@echo -e "\\033[0;32mSuccess"'!'"\\033[0;39m Here's your SDK: \\033[1m$<\\033[0m"
@echo ""
@echo "It will be picked up automatically if you now proceed to build Frida."
@echo ""
clean: $(foreach pkg, $(call expand-packages,$(packages)), clean-$(pkg))
distclean: $(foreach pkg, $(call expand-packages,$(packages)), distclean-$(pkg))
build/sdk-$(host_machine).tar.bz2: build/fs-tmp-$(host_machine)/.package-stamp
@$(call print-status,📦,Compressing)
@tar \
-C build/fs-tmp-$(host_machine)/package \
-cjf $(shell pwd)/[email protected] \
.
@mv [email protected] $@
build/fs-tmp-%/.package-stamp: $(foreach pkg, $(packages), build/fs-%/manifest/$(pkg).pkg)
@echo
@$(call print-status,📦,Assembling)
@$(RM) -r $(@D)/package
@mkdir -p $(@D)/package
@cd build/fs-$*; \
programs=""; \
[ -d bin/$(host_os_arch) ] && programs=bin/$(host_os_arch); \
[ -d bin/$(build_os_arch) ] && programs=bin/$(build_os_arch); \
[ -d lib/tcc ] && tcc=lib/tcc || tcc=""; \
[ -d lib/c++ ] && libcpp=lib/c++/*.a || libcpp=""; \
[ -d lib/gio/modules ] && gio_modules=lib/gio/modules/*.a || gio_modules=""; \
[ -d lib32 ] && lib32=lib32 || lib32=""; \
[ -d lib64 ] && lib64=lib64 || lib64=""; \
[ -d libdata ] && libdatadir=libdata || libdatadir=lib; \
tar -cf - \
$$programs \
include \
lib/*.a \
lib/glib-2.0 \
lib/libffi* \
$$libdatadir/pkgconfig \
$$tcc \
$$libcpp \
$$gio_modules \
$$lib32 \
$$lib64 \
manifest \
share/glib-2.0/schemas \
share/vala \
| tar -C $(shell pwd)/$(@D)/package -xf -
@releng/pkgify.sh "$(@D)/package" "$(shell pwd)/build/fs-$*" "$(shell pwd)/releng"
@echo "$(frida_deps_version)" > $(@D)/package/VERSION.txt
@touch $@
$(eval $(call make-package-rules,$(packages),fs))
build/fs-env-%.rc:
@if [ $* != $(build_machine) ]; then \
cross=yes; \
else \
cross=no; \
fi; \
for os_arch in $(build_machine) $*; do \
if [ ! -f build/fs-env-$$os_arch.rc ]; then \
FRIDA_HOST=$$os_arch \
FRIDA_CROSS=$$cross \
FRIDA_ASAN=$(FRIDA_ASAN) \
FRIDA_ENV_NAME=fs \
FRIDA_ENV_SDK=none \
FRIDA_TOOLCHAIN_VERSION=$(frida_bootstrap_version) \
XCODE11="$(XCODE11)" \
./releng/setup-env.sh || exit 1; \
fi \
done
releng/meson/meson.py:
git submodule init releng/meson
git submodule update releng/meson
@touch $@
.SECONDARY: