Skip to content

Commit

Permalink
Move ffi and fix build path
Browse files Browse the repository at this point in the history
  • Loading branch information
perklet committed Feb 2, 2024
1 parent 19e3030 commit 5ca2939
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include ffi/*
include curl_cffi/_wrapper.*
include curl_cffi/ffi/*
include curl_cffi/include/curl/*
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 6 additions & 4 deletions scripts/build.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import struct
import platform
from pathlib import Path

from cffi import FFI

Expand All @@ -19,6 +20,7 @@
else:
libdir = os.path.expanduser("~/.local/lib")

root_dir = Path(__file__).parent.parent

ffibuilder.set_source(
"curl_cffi._wrapper",
Expand All @@ -29,19 +31,19 @@
library_dirs=[libdir],
source_extension=".c",
include_dirs=[
os.path.join(os.path.dirname(__file__), "include"),
os.path.join(os.path.dirname(__file__), "ffi"),
str(root_dir / "curl_cffi/include"),
str(root_dir / "ffi"),
],
sources=[
os.path.join(os.path.dirname(__file__), "ffi/shim.c"),
str(root_dir / "ffi/shim.c"),
],
extra_compile_args=(
["-Wno-implicit-function-declaration"] if uname.system == "Darwin" else []
),
# extra_link_args=["-Wl,-rpath,$ORIGIN/../libcurl/" + arch],
)

with open(os.path.join(os.path.dirname(__file__), "ffi/cdef.c")) as f:
with open(root_dir / "ffi/cdef.c") as f:
cdef_content = f.read()
ffibuilder.cdef(cdef_content)

Expand Down

0 comments on commit 5ca2939

Please sign in to comment.