forked from ProcursusTeam/Procursus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrotli.mk
75 lines (64 loc) · 2.66 KB
/
brotli.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
ifneq ($(PROCURSUS),1)
$(error Use the main Makefile)
endif
SUBPROJECTS += brotli
BROTLI_VERSION := 1.0.7
DEB_BROTLI_V ?= $(BROTLI_VERSION)
brotli-setup: setup
ifeq ($(wildcard $(BUILD_SOURCE)/brotli-$(BROTLI_VERSION).tar.gz),)
wget -q -nc -P $(BUILD_SOURCE) https://github.com/google/brotli/archive/v$(BROTLI_VERSION).tar.gz
mv $(BUILD_SOURCE)/v$(BROTLI_VERSION).tar.gz $(BUILD_SOURCE)/brotli-$(BROTLI_VERSION).tar.gz
endif
$(call EXTRACT_TAR,brotli-$(BROTLI_VERSION).tar.gz,brotli-$(BROTLI_VERSION),brotli)
ifneq ($(wildcard $(BUILD_WORK)/brotli/.build_complete),)
brotli:
@echo "Using previously built brotli."
else
brotli: brotli-setup
cd $(BUILD_WORK)/brotli && cmake . \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SYSTEM_NAME=Darwin \
-DCMAKE_CROSSCOMPILING=true \
-DCMAKE_INSTALL_NAME_TOOL=$(I_N_T) \
-DCMAKE_INSTALL_PREFIX=/ \
-DCMAKE_INSTALL_NAME_DIR=/usr/lib \
-DCMAKE_INSTALL_RPATH=/usr \
-DCMAKE_OSX_SYSROOT="$(TARGET_SYSROOT)" \
-DCMAKE_C_FLAGS="$(CFLAGS)" \
-DCMAKE_FIND_ROOT_PATH=$(BUILD_BASE) \
-DCMAKE_AUTOGEN_PARALLEL=6
+$(MAKE) -C $(BUILD_WORK)/brotli
+$(MAKE) -C $(BUILD_WORK)/brotli install \
DESTDIR="$(BUILD_STAGE)/brotli"
for lib in $(BUILD_STAGE)/brotli/usr/lib/libbrotli{common,dec,enc}-static.a; do \
if [ -f $$lib ]; then \
mv $$lib $${lib/-static.a/.a}; \
fi; \
done
touch $(BUILD_WORK)/brotli/.build_complete
endif
brotli-package: brotli-stage
# brotli.mk Package Structure
rm -rf $(BUILD_DIST)/{brotli,libbrotli-dev,libbrotli1}
mkdir -p $(BUILD_DIST)/brotli/usr/{bin,share/man/man1} \
$(BUILD_DIST)/libbrotli-dev/usr/{include/brotli,lib/pkgconfig} \
$(BUILD_DIST)/libbrotli1/usr/lib
# brotli.mk Prep brotli
cp -a $(BUILD_STAGE)/brotli/usr/bin/brotli $(BUILD_DIST)/brotli/usr/bin
cp -a $(BUILD_WORK)/brotli/docs/brotli.1 $(BUILD_DIST)/brotli/usr/share/man/man1
# brotli.mk Prep libbrotli-dev
cp -a $(BUILD_STAGE)/brotli/usr/include/brotli/{decode,encode,port,types}.h $(BUILD_DIST)/libbrotli-dev/usr/include/brotli
cp -a $(BUILD_STAGE)/brotli/usr/lib/libbrotli{common,dec,enc}.{a,dylib} $(BUILD_DIST)/libbrotli-dev/usr/lib
cp -a $(BUILD_STAGE)/brotli/usr/lib/pkgconfig/libbrotli{common,dec,enc}.pc $(BUILD_DIST)/libbrotli-dev/usr/lib/pkgconfig
# brotli.mk Prep libbrotli1
cp -a $(BUILD_STAGE)/brotli/usr/lib/libbrotli{common,dec,enc}.1*.dylib $(BUILD_DIST)/libbrotli1/usr/lib
# brotli.mk Sign
$(call SIGN,brotli,general.xml)
$(call SIGN,libbrotli1,general.xml)
# brotli.mk Make .debs
$(call PACK,brotli,DEB_BROTLI_V)
$(call PACK,libbrotli-dev,DEB_BROTLI_V)
$(call PACK,libbrotli1,DEB_BROTLI_V)
# brotli.mk Build cleanup
rm -rf $(BUILD_DIST)/{brotli,libbrotli-dev,libbrotli1}
.PHONY: brotli brotli-package