Skip to content

Commit

Permalink
feat: Add script to find library path
Browse files Browse the repository at this point in the history
  • Loading branch information
cauliyang committed Oct 31, 2023
1 parent 9ac13ff commit fac89cc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,12 @@ jobs:
export MACOSX_DEPLOYMENT_TARGET=12.0
export MACOS_DEPLOYMENT_TARGET=12.0
python ./.github/workflows/scripts/find_lib.py ssl
PREFIX="/usr/local/Cellar/openssl@3/3.1.3"
ls $PREFIX
export CFLAGS="$CFLAGS -Wno-implicit-function-declaration -I$PREFIX/include"
export CXXFLAGS="$CXXFLAGS -I$PREFIX/include"
export LDFLAGS="$LDFLAGS -Wl,-S -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -lssl -lcrypto"
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/scripts/find_lib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import sys
from ctypes.util import find_library
from pathlib import Path


def main():
"""Find a library and print its path."""
libname = sys.argv[1]
libpath = find_library(libname)
if libpath is None:
print(f"Could not find library {libname}") # noqa: T201
return 1
libbase = Path(libpath)
libbase = libbase.resolve()
print(libbase) # noqa: T201
return 0


if __name__ == "__main__":
sys.exit(main())

0 comments on commit fac89cc

Please sign in to comment.