-
-
Notifications
You must be signed in to change notification settings - Fork 532
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (63 loc) · 2.12 KB
/
Copy pathMakefile
File metadata and controls
79 lines (63 loc) · 2.12 KB
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
.ONESHELL:
SHELL := bash
PYTHON ?= python3
PIP ?= $(PYTHON) -m pip
# this is the upstream libcurl-impersonate version
VERSION := 2.1.0
CURL_VERSION := curl-8_21_0
ifeq ($(OS),Windows_NT)
CURRENT_USER := $(shell echo %USERNAME%)
else
CURRENT_USER := $(shell whoami)
endif
$(CURL_VERSION):
curl -L https://github.com/curl/curl/archive/$(CURL_VERSION).zip -o curl.zip
unzip -q -o curl.zip
mv curl-$(CURL_VERSION) $(CURL_VERSION)
curl-impersonate-$(VERSION)/patches: $(CURL_VERSION)
curl -L "https://github.com/lexiforest/curl-impersonate/archive/refs/tags/v$(VERSION).tar.gz" \
-o "curl-impersonate-$(VERSION).tar.gz"
tar -xf curl-impersonate-$(VERSION).tar.gz
.preprocessed: curl-impersonate-$(VERSION)/patches
cd $(CURL_VERSION)
# for p in $</curl*.patch; do patch -p1 < ../$$p; done
patch -p1 < ../$</curl.patch
# Re-generate the configure script
autoreconf -fi
mkdir -p ../include/curl
cp -R include/curl/* ../include/curl/
# Sentinel files: https://tech.davis-hansson.com/p/make/
cd ..
touch .preprocessed
local-curl: $(CURL_VERSION)
cp /usr/local/lib/libcurl-impersonate* /Users/$(CURRENT_USER)/work/_temp/install/lib/
cd $(CURL_VERSION)
for p in ../curl-impersonate/patches/curl*.patch; do patch -p1 < ../$$p; done
# Re-generate the configure script
autoreconf -fi
mkdir -p ../include/curl
cp -R include/curl/* ../include/curl/
# Sentinel files: https://tech.davis-hansson.com/p/make/
touch .preprocessed
gen-const:
$(PYTHON) scripts/generate_consts.py $(CURL_VERSION)
preprocess: .preprocessed
@echo generating patched libcurl header files
install-editable:
$(PIP) install -e .
build: .preprocessed
rm -rf dist/
$(PIP) install build
$(PYTHON) -m build --wheel
lint:
uv run ruff check --exclude issues
format:
uv run ruff format --exclude issues
test:
$(PYTHON) -bb -m pytest tests/unittest
clean:
rm -rf build/ dist/ curl_cffi.egg-info/ $(CURL_VERSION)/ curl-impersonate-$(VERSION)/
rm -rf curl_cffi/*.o curl_cffi/*.so curl_cffi/_wrapper.c
rm -rf .preprocessed $(CURL_VERSION).tar.xz curl-impersonate-$(VERSION).tar.gz
rm -rf include/
.PHONY: clean build test install-editable preprocess gen-const