Compare commits
5 Commits
zstd/v1.5.
...
openssl3/v
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec99b49198 | ||
|
|
31b96deac5 | ||
|
|
6fe17e7b31 | ||
|
|
2377af3f1f | ||
|
|
b9f89a5a5d |
@@ -49,7 +49,6 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
chmod +x "$INSTALL_DIR/git-lfs"
|
chmod +x "$INSTALL_DIR/git-lfs"
|
||||||
strip "$INSTALL_DIR/git-lfs" 2>/dev/null || true
|
|
||||||
|
|
||||||
rm -f "$FILENAME"
|
rm -f "$FILENAME"
|
||||||
|
|
||||||
|
|||||||
56
libjpeg/build.sh
Executable file
56
libjpeg/build.sh
Executable file
@@ -0,0 +1,56 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
VERSION="3.1.0"
|
||||||
|
INSTALL_DIR="$DIR/libjpeg/install"
|
||||||
|
|
||||||
|
# Idempotent: skip if already built
|
||||||
|
if [ -f "$INSTALL_DIR/lib/libjpeg.a" ]; then
|
||||||
|
echo "libjpeg already present, skipping build."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
|
||||||
|
# Clone
|
||||||
|
if [ ! -d "libjpeg-turbo-src" ]; then
|
||||||
|
git clone --depth 1 --branch "${VERSION}" https://github.com/libjpeg-turbo/libjpeg-turbo.git libjpeg-turbo-src
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build
|
||||||
|
PREFIX="$DIR/build/prefix"
|
||||||
|
mkdir -p "$DIR/build"
|
||||||
|
|
||||||
|
cmake -S libjpeg-turbo-src -B "$DIR/build" \
|
||||||
|
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
||||||
|
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF \
|
||||||
|
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
|
||||||
|
-DCMAKE_INSTALL_LIBDIR=lib \
|
||||||
|
-DENABLE_SHARED=OFF \
|
||||||
|
-DENABLE_STATIC=ON \
|
||||||
|
-DWITH_TURBOJPEG=OFF
|
||||||
|
|
||||||
|
cmake --build "$DIR/build" -j"$NJOBS"
|
||||||
|
cmake --install "$DIR/build"
|
||||||
|
|
||||||
|
# Copy to package install dir
|
||||||
|
rm -rf "$INSTALL_DIR"
|
||||||
|
mkdir -p "$INSTALL_DIR"/{lib,include}
|
||||||
|
|
||||||
|
# Library
|
||||||
|
cp "$PREFIX/lib/libjpeg.a" "$INSTALL_DIR/lib/"
|
||||||
|
|
||||||
|
# Headers
|
||||||
|
cp "$PREFIX/include/jpeglib.h" "$INSTALL_DIR/include/"
|
||||||
|
cp "$PREFIX/include/jconfig.h" "$INSTALL_DIR/include/"
|
||||||
|
cp "$PREFIX/include/jerror.h" "$INSTALL_DIR/include/"
|
||||||
|
cp "$PREFIX/include/jmorecfg.h" "$INSTALL_DIR/include/"
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
rm -rf libjpeg-turbo-src "$DIR/build"
|
||||||
|
|
||||||
|
echo "Installed libjpeg to $INSTALL_DIR"
|
||||||
|
du -sh "$INSTALL_DIR"
|
||||||
10
libjpeg/libjpeg/__init__.py
Normal file
10
libjpeg/libjpeg/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||||
|
LIB_DIR = os.path.join(DIR, "lib")
|
||||||
|
INCLUDE_DIR = os.path.join(DIR, "include")
|
||||||
|
|
||||||
|
|
||||||
|
def smoketest():
|
||||||
|
assert os.path.isfile(os.path.join(LIB_DIR, "libjpeg.a")), "libjpeg.a not found"
|
||||||
|
assert os.path.isfile(os.path.join(INCLUDE_DIR, "jpeglib.h")), "jpeglib.h not found"
|
||||||
15
libjpeg/pyproject.toml
Normal file
15
libjpeg/pyproject.toml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=64", "wheel"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "libjpeg"
|
||||||
|
version = "3.1.0"
|
||||||
|
description = "libjpeg-turbo JPEG library (static build)"
|
||||||
|
requires-python = ">=3.8"
|
||||||
|
|
||||||
|
[tool.setuptools.packages.find]
|
||||||
|
include = ["libjpeg*"]
|
||||||
|
|
||||||
|
[tool.setuptools.package-data]
|
||||||
|
libjpeg = ["install/**/*"]
|
||||||
61
libjpeg/setup.py
Normal file
61
libjpeg/setup.py
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import os
|
||||||
|
import platform
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
from setuptools.command.build_py import build_py
|
||||||
|
|
||||||
|
try:
|
||||||
|
from wheel.bdist_wheel import bdist_wheel
|
||||||
|
except ImportError:
|
||||||
|
bdist_wheel = None
|
||||||
|
|
||||||
|
|
||||||
|
class BuildLibjpeg(build_py):
|
||||||
|
"""Run build.sh to compile libjpeg-turbo before collecting package data."""
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
marker = os.path.join(pkg_dir, "libjpeg", "install", "lib", "libjpeg.a")
|
||||||
|
|
||||||
|
if not os.path.exists(marker):
|
||||||
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
|
|
||||||
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
|
cmdclass = {"build_py": BuildLibjpeg}
|
||||||
|
|
||||||
|
if bdist_wheel is not None:
|
||||||
|
|
||||||
|
class PlatformWheel(bdist_wheel):
|
||||||
|
"""Produce a platform-specific, Python-version-agnostic wheel."""
|
||||||
|
|
||||||
|
def finalize_options(self):
|
||||||
|
super().finalize_options()
|
||||||
|
self.root_is_pure = False
|
||||||
|
|
||||||
|
def get_tag(self):
|
||||||
|
system = platform.system()
|
||||||
|
machine = platform.machine()
|
||||||
|
|
||||||
|
if system == "Linux":
|
||||||
|
plat = f"linux_{machine}"
|
||||||
|
elif system == "Darwin":
|
||||||
|
plat = "macosx_11_0_arm64"
|
||||||
|
else:
|
||||||
|
plat = f"{system.lower()}_{machine}"
|
||||||
|
|
||||||
|
return "py3", "none", plat
|
||||||
|
|
||||||
|
cmdclass["bdist_wheel"] = PlatformWheel
|
||||||
|
|
||||||
|
|
||||||
|
def setup():
|
||||||
|
from setuptools import setup as _setup
|
||||||
|
|
||||||
|
_setup(cmdclass=cmdclass)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
setup()
|
||||||
74
openssl3/build.sh
Executable file
74
openssl3/build.sh
Executable file
@@ -0,0 +1,74 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
VERSION="3.4.1"
|
||||||
|
INSTALL_DIR="$DIR/openssl3/install"
|
||||||
|
|
||||||
|
# Idempotent: skip if already built
|
||||||
|
if [ -f "$INSTALL_DIR/lib/libcrypto.a" ]; then
|
||||||
|
echo "openssl already present, skipping build."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
|
||||||
|
# Download
|
||||||
|
TARBALL="openssl-${VERSION}.tar.gz"
|
||||||
|
if [ ! -d "openssl-src" ]; then
|
||||||
|
curl -fSL -o "$TARBALL" "https://github.com/openssl/openssl/releases/download/openssl-${VERSION}/${TARBALL}"
|
||||||
|
mkdir -p openssl-src
|
||||||
|
tar -xf "$TARBALL" -C openssl-src --strip-components=1
|
||||||
|
rm -f "$TARBALL"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configure
|
||||||
|
PREFIX="$DIR/build/prefix"
|
||||||
|
cd openssl-src
|
||||||
|
|
||||||
|
if [ "$(uname)" = "Darwin" ]; then
|
||||||
|
TARGET="darwin64-arm64-cc"
|
||||||
|
else
|
||||||
|
MACHINE="$(uname -m)"
|
||||||
|
if [ "$MACHINE" = "x86_64" ]; then
|
||||||
|
TARGET="linux-x86_64"
|
||||||
|
elif [ "$MACHINE" = "aarch64" ]; then
|
||||||
|
TARGET="linux-aarch64"
|
||||||
|
else
|
||||||
|
TARGET="linux-${MACHINE}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
./Configure "$TARGET" \
|
||||||
|
--prefix="$PREFIX" \
|
||||||
|
--libdir=lib \
|
||||||
|
no-shared \
|
||||||
|
no-tests \
|
||||||
|
no-docs \
|
||||||
|
no-apps \
|
||||||
|
-Os
|
||||||
|
|
||||||
|
# Build
|
||||||
|
make -j"$NJOBS"
|
||||||
|
make install_sw
|
||||||
|
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
# Copy to package install dir
|
||||||
|
rm -rf "$INSTALL_DIR"
|
||||||
|
mkdir -p "$INSTALL_DIR"/{lib,include}
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
cp "$PREFIX/lib/libcrypto.a" "$INSTALL_DIR/lib/"
|
||||||
|
cp "$PREFIX/lib/libssl.a" "$INSTALL_DIR/lib/"
|
||||||
|
|
||||||
|
# Headers
|
||||||
|
cp -r "$PREFIX/include/openssl" "$INSTALL_DIR/include/"
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
rm -rf openssl-src "$DIR/build"
|
||||||
|
|
||||||
|
echo "Installed openssl to $INSTALL_DIR"
|
||||||
|
du -sh "$INSTALL_DIR"
|
||||||
11
openssl3/openssl3/__init__.py
Normal file
11
openssl3/openssl3/__init__.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||||
|
LIB_DIR = os.path.join(DIR, "lib")
|
||||||
|
INCLUDE_DIR = os.path.join(DIR, "include")
|
||||||
|
|
||||||
|
|
||||||
|
def smoketest():
|
||||||
|
assert os.path.isfile(os.path.join(LIB_DIR, "libcrypto.a")), "libcrypto.a not found"
|
||||||
|
assert os.path.isfile(os.path.join(LIB_DIR, "libssl.a")), "libssl.a not found"
|
||||||
|
assert os.path.isdir(os.path.join(INCLUDE_DIR, "openssl")), "openssl headers not found"
|
||||||
15
openssl3/pyproject.toml
Normal file
15
openssl3/pyproject.toml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=64", "wheel"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "openssl3"
|
||||||
|
version = "3.4.1"
|
||||||
|
description = "OpenSSL cryptography library (static build)"
|
||||||
|
requires-python = ">=3.8"
|
||||||
|
|
||||||
|
[tool.setuptools.packages.find]
|
||||||
|
include = ["openssl3*"]
|
||||||
|
|
||||||
|
[tool.setuptools.package-data]
|
||||||
|
openssl3 = ["install/**/*"]
|
||||||
61
openssl3/setup.py
Normal file
61
openssl3/setup.py
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import os
|
||||||
|
import platform
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
from setuptools.command.build_py import build_py
|
||||||
|
|
||||||
|
try:
|
||||||
|
from wheel.bdist_wheel import bdist_wheel
|
||||||
|
except ImportError:
|
||||||
|
bdist_wheel = None
|
||||||
|
|
||||||
|
|
||||||
|
class BuildOpenssl(build_py):
|
||||||
|
"""Run build.sh to compile OpenSSL before collecting package data."""
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
marker = os.path.join(pkg_dir, "openssl3", "install", "lib", "libcrypto.a")
|
||||||
|
|
||||||
|
if not os.path.exists(marker):
|
||||||
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
|
|
||||||
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
|
cmdclass = {"build_py": BuildOpenssl}
|
||||||
|
|
||||||
|
if bdist_wheel is not None:
|
||||||
|
|
||||||
|
class PlatformWheel(bdist_wheel):
|
||||||
|
"""Produce a platform-specific, Python-version-agnostic wheel."""
|
||||||
|
|
||||||
|
def finalize_options(self):
|
||||||
|
super().finalize_options()
|
||||||
|
self.root_is_pure = False
|
||||||
|
|
||||||
|
def get_tag(self):
|
||||||
|
system = platform.system()
|
||||||
|
machine = platform.machine()
|
||||||
|
|
||||||
|
if system == "Linux":
|
||||||
|
plat = f"linux_{machine}"
|
||||||
|
elif system == "Darwin":
|
||||||
|
plat = "macosx_11_0_arm64"
|
||||||
|
else:
|
||||||
|
plat = f"{system.lower()}_{machine}"
|
||||||
|
|
||||||
|
return "py3", "none", plat
|
||||||
|
|
||||||
|
cmdclass["bdist_wheel"] = PlatformWheel
|
||||||
|
|
||||||
|
|
||||||
|
def setup():
|
||||||
|
from setuptools import setup as _setup
|
||||||
|
|
||||||
|
_setup(cmdclass=cmdclass)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
setup()
|
||||||
@@ -26,7 +26,7 @@ mkdir -p "$DIR/build"
|
|||||||
|
|
||||||
cmake -S zstd-src/build/cmake -B "$DIR/build" \
|
cmake -S zstd-src/build/cmake -B "$DIR/build" \
|
||||||
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
||||||
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
|
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF \
|
||||||
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
|
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
|
||||||
-DCMAKE_INSTALL_LIBDIR=lib \
|
-DCMAKE_INSTALL_LIBDIR=lib \
|
||||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
||||||
|
|||||||
Reference in New Issue
Block a user