Compare commits
6 Commits
nanosvg/v0
...
libusb/v1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14d916d054 | ||
|
|
62afc9ea71 | ||
|
|
c55046f7f0 | ||
|
|
a78417ecd1 | ||
|
|
d14d45aef4 | ||
|
|
224cbbb783 |
@@ -5,6 +5,7 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
|||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
|
|
||||||
INSTALL_DIR="$DIR/imgui/install"
|
INSTALL_DIR="$DIR/imgui/install"
|
||||||
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
|
||||||
# Dear ImGui (docking branch, version 1.92.7)
|
# Dear ImGui (docking branch, version 1.92.7)
|
||||||
IMGUI_COMMIT="934c6a5f5ef2355d6df25395d555cb71f790c4e9"
|
IMGUI_COMMIT="934c6a5f5ef2355d6df25395d555cb71f790c4e9"
|
||||||
@@ -12,6 +13,8 @@ IMGUI_COMMIT="934c6a5f5ef2355d6df25395d555cb71f790c4e9"
|
|||||||
IMPLOT_COMMIT="93c801b4bb801c5c11031d880b6af1d1f70bd79d"
|
IMPLOT_COMMIT="93c801b4bb801c5c11031d880b6af1d1f70bd79d"
|
||||||
# rlImGui
|
# rlImGui
|
||||||
RLIMGUI_COMMIT="286e11acd6c785004c9550c7ed3762add2ae3d47"
|
RLIMGUI_COMMIT="286e11acd6c785004c9550c7ed3762add2ae3d47"
|
||||||
|
# GLFW 3.4
|
||||||
|
GLFW_COMMIT="7b6aead9fb88b3623e3b3725ebb42670cbe4c579"
|
||||||
|
|
||||||
# Clone/update imgui
|
# Clone/update imgui
|
||||||
if [ ! -d "imgui-src/.git" ]; then
|
if [ ! -d "imgui-src/.git" ]; then
|
||||||
@@ -37,9 +40,42 @@ fi
|
|||||||
git -C rlimgui-src fetch --depth 1 origin "$RLIMGUI_COMMIT"
|
git -C rlimgui-src fetch --depth 1 origin "$RLIMGUI_COMMIT"
|
||||||
git -C rlimgui-src checkout --force "$RLIMGUI_COMMIT"
|
git -C rlimgui-src checkout --force "$RLIMGUI_COMMIT"
|
||||||
|
|
||||||
|
# Clone/update GLFW
|
||||||
|
if [ ! -d "glfw-src/.git" ]; then
|
||||||
|
rm -rf glfw-src
|
||||||
|
git clone --depth 1 https://github.com/glfw/glfw.git glfw-src
|
||||||
|
fi
|
||||||
|
git -C glfw-src fetch --depth 1 origin "$GLFW_COMMIT"
|
||||||
|
git -C glfw-src checkout --force "$GLFW_COMMIT"
|
||||||
|
|
||||||
|
# Install GLFW build dependencies
|
||||||
|
if [[ "$(uname)" == "Linux" ]]; then
|
||||||
|
if command -v dnf &>/dev/null; then
|
||||||
|
dnf install -y libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel libXi-devel mesa-libGL-devel \
|
||||||
|
wayland-devel wayland-protocols-devel libxkbcommon-devel
|
||||||
|
elif command -v apt-get &>/dev/null; then
|
||||||
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
|
apt-get update && apt-get install -y libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libgl-dev \
|
||||||
|
libwayland-dev wayland-protocols libxkbcommon-dev
|
||||||
|
else
|
||||||
|
sudo apt-get update && sudo apt-get install -y libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libgl-dev \
|
||||||
|
libwayland-dev wayland-protocols libxkbcommon-dev
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build GLFW static library
|
||||||
|
cmake -B glfw-src/build -S glfw-src \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DBUILD_SHARED_LIBS=OFF \
|
||||||
|
-DGLFW_BUILD_EXAMPLES=OFF \
|
||||||
|
-DGLFW_BUILD_TESTS=OFF \
|
||||||
|
-DGLFW_BUILD_DOCS=OFF
|
||||||
|
cmake --build glfw-src/build --parallel "$NJOBS"
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
rm -rf "$INSTALL_DIR"
|
rm -rf "$INSTALL_DIR"
|
||||||
mkdir -p "$INSTALL_DIR/include/extras" "$INSTALL_DIR/src"
|
mkdir -p "$INSTALL_DIR/include/extras" "$INSTALL_DIR/src" "$INSTALL_DIR/lib"
|
||||||
|
|
||||||
# imgui
|
# imgui
|
||||||
cp imgui-src/imgui.h imgui-src/imgui_internal.h imgui-src/imconfig.h \
|
cp imgui-src/imgui.h imgui-src/imgui_internal.h imgui-src/imconfig.h \
|
||||||
@@ -49,8 +85,10 @@ cp imgui-src/imgui.cpp imgui-src/imgui_draw.cpp imgui-src/imgui_tables.cpp \
|
|||||||
imgui-src/imgui_widgets.cpp imgui-src/imgui_demo.cpp \
|
imgui-src/imgui_widgets.cpp imgui-src/imgui_demo.cpp \
|
||||||
"$INSTALL_DIR/src/"
|
"$INSTALL_DIR/src/"
|
||||||
cp imgui-src/backends/imgui_impl_opengl3.h imgui-src/backends/imgui_impl_opengl3_loader.h \
|
cp imgui-src/backends/imgui_impl_opengl3.h imgui-src/backends/imgui_impl_opengl3_loader.h \
|
||||||
|
imgui-src/backends/imgui_impl_glfw.h \
|
||||||
"$INSTALL_DIR/include/"
|
"$INSTALL_DIR/include/"
|
||||||
cp imgui-src/backends/imgui_impl_opengl3.cpp "$INSTALL_DIR/src/"
|
cp imgui-src/backends/imgui_impl_opengl3.cpp imgui-src/backends/imgui_impl_glfw.cpp \
|
||||||
|
"$INSTALL_DIR/src/"
|
||||||
|
|
||||||
# implot
|
# implot
|
||||||
cp implot-src/implot.h implot-src/implot_internal.h "$INSTALL_DIR/include/"
|
cp implot-src/implot.h implot-src/implot_internal.h "$INSTALL_DIR/include/"
|
||||||
@@ -63,5 +101,9 @@ cp rlimgui-src/extras/FA6FreeSolidFontData.h rlimgui-src/extras/IconsFontAwesome
|
|||||||
"$INSTALL_DIR/include/extras/"
|
"$INSTALL_DIR/include/extras/"
|
||||||
cp rlimgui-src/rlImGui.cpp "$INSTALL_DIR/src/"
|
cp rlimgui-src/rlImGui.cpp "$INSTALL_DIR/src/"
|
||||||
|
|
||||||
|
# glfw
|
||||||
|
cp glfw-src/build/src/libglfw3.a "$INSTALL_DIR/lib/"
|
||||||
|
cp -r glfw-src/include/GLFW "$INSTALL_DIR/include/"
|
||||||
|
|
||||||
echo "Installed imgui to $INSTALL_DIR"
|
echo "Installed imgui to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
@@ -3,8 +3,11 @@ import os
|
|||||||
DIR = os.path.join(os.path.dirname(__file__), "install")
|
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||||
INCLUDE_DIR = os.path.join(DIR, "include")
|
INCLUDE_DIR = os.path.join(DIR, "include")
|
||||||
SRC_DIR = os.path.join(DIR, "src")
|
SRC_DIR = os.path.join(DIR, "src")
|
||||||
|
LIB_DIR = os.path.join(DIR, "lib")
|
||||||
|
|
||||||
|
|
||||||
def smoketest():
|
def smoketest():
|
||||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "imgui.h")), "imgui.h not found"
|
assert os.path.isfile(os.path.join(INCLUDE_DIR, "imgui.h")), "imgui.h not found"
|
||||||
assert os.path.isfile(os.path.join(SRC_DIR, "imgui.cpp")), "imgui.cpp not found"
|
assert os.path.isfile(os.path.join(SRC_DIR, "imgui.cpp")), "imgui.cpp not found"
|
||||||
|
assert os.path.isfile(os.path.join(LIB_DIR, "libglfw3.a")), "libglfw3.a not found"
|
||||||
|
assert os.path.isfile(os.path.join(INCLUDE_DIR, "GLFW", "glfw3.h")), "GLFW/glfw3.h not found"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
[project]
|
[project]
|
||||||
name = "imgui"
|
name = "imgui"
|
||||||
version = "1.92.7"
|
version = "1.92.7"
|
||||||
description = "Dear ImGui + ImPlot + rlImGui (source distribution)"
|
description = "Dear ImGui + ImPlot + rlImGui + GLFW 3.4 (static)"
|
||||||
requires-python = ">=3.8"
|
requires-python = ">=3.8"
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
|
|||||||
52
libusb/build.sh
Executable file
52
libusb/build.sh
Executable file
@@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
VERSION="1.0.29"
|
||||||
|
ARCHIVE="libusb-${VERSION}.tar.bz2"
|
||||||
|
URL="https://github.com/libusb/libusb/releases/download/v${VERSION}/${ARCHIVE}"
|
||||||
|
INSTALL_DIR="$DIR/libusb/install"
|
||||||
|
SRC_DIR="$DIR/libusb-src"
|
||||||
|
VERSION_FILE="$SRC_DIR/.version"
|
||||||
|
|
||||||
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
export CC="ccache ${CC:-cc}"
|
||||||
|
|
||||||
|
if [ ! -f "$VERSION_FILE" ] || [ "$(cat "$VERSION_FILE")" != "$VERSION" ]; then
|
||||||
|
rm -rf "$SRC_DIR"
|
||||||
|
mkdir -p "$SRC_DIR"
|
||||||
|
curl -fSL "$URL" | tar xj --strip-components=1 -C "$SRC_DIR"
|
||||||
|
echo "$VERSION" > "$VERSION_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PREFIX="$DIR/build/prefix"
|
||||||
|
rm -rf "$DIR/build"
|
||||||
|
mkdir -p "$DIR/build"
|
||||||
|
|
||||||
|
CONFIGURE_ARGS=(
|
||||||
|
--prefix="$PREFIX"
|
||||||
|
--disable-shared
|
||||||
|
--enable-static
|
||||||
|
)
|
||||||
|
|
||||||
|
if [ "$(uname)" = "Linux" ]; then
|
||||||
|
CONFIGURE_ARGS+=(--disable-udev)
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$SRC_DIR"
|
||||||
|
CFLAGS="-O2 -fPIC" ./configure "${CONFIGURE_ARGS[@]}"
|
||||||
|
make -j"$NJOBS"
|
||||||
|
make install
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
rm -rf "$INSTALL_DIR"
|
||||||
|
mkdir -p "$INSTALL_DIR/lib/pkgconfig" "$INSTALL_DIR/include/libusb-1.0"
|
||||||
|
|
||||||
|
cp "$PREFIX/lib/libusb-1.0.a" "$INSTALL_DIR/lib/"
|
||||||
|
cp "$PREFIX/lib/pkgconfig/libusb-1.0.pc" "$INSTALL_DIR/lib/pkgconfig/"
|
||||||
|
cp "$PREFIX/include/libusb-1.0/libusb.h" "$INSTALL_DIR/include/libusb-1.0/"
|
||||||
|
|
||||||
|
echo "Installed libusb to $INSTALL_DIR"
|
||||||
|
du -sh "$INSTALL_DIR"
|
||||||
12
libusb/libusb/__init__.py
Normal file
12
libusb/libusb/__init__.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
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")
|
||||||
|
PKGCONFIG_DIR = os.path.join(LIB_DIR, "pkgconfig")
|
||||||
|
|
||||||
|
|
||||||
|
def smoketest():
|
||||||
|
assert os.path.isfile(os.path.join(LIB_DIR, "libusb-1.0.a")), "libusb-1.0.a not found"
|
||||||
|
assert os.path.isfile(os.path.join(INCLUDE_DIR, "libusb-1.0", "libusb.h")), "libusb.h not found"
|
||||||
|
assert os.path.isfile(os.path.join(PKGCONFIG_DIR, "libusb-1.0.pc")), "libusb-1.0.pc not found"
|
||||||
15
libusb/pyproject.toml
Normal file
15
libusb/pyproject.toml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=64", "wheel"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "libusb"
|
||||||
|
version = "1.0.29"
|
||||||
|
description = "libusb USB device access library (static build)"
|
||||||
|
requires-python = ">=3.8"
|
||||||
|
|
||||||
|
[tool.setuptools.packages.find]
|
||||||
|
include = ["libusb*"]
|
||||||
|
|
||||||
|
[tool.setuptools.package-data]
|
||||||
|
libusb = ["install/**/*"]
|
||||||
58
libusb/setup.py
Normal file
58
libusb/setup.py
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
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 BuildLibusb(build_py):
|
||||||
|
"""Run build.sh to compile libusb before collecting package data."""
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
|
|
||||||
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
|
cmdclass = {"build_py": BuildLibusb}
|
||||||
|
|
||||||
|
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()
|
||||||
@@ -9,10 +9,12 @@ members = [
|
|||||||
"git-lfs",
|
"git-lfs",
|
||||||
"imgui",
|
"imgui",
|
||||||
"json11",
|
"json11",
|
||||||
|
"libusb",
|
||||||
"libjpeg",
|
"libjpeg",
|
||||||
"libyuv",
|
"libyuv",
|
||||||
"nanosvg",
|
"nanosvg",
|
||||||
"ncurses",
|
"ncurses",
|
||||||
|
"qt5",
|
||||||
"raylib",
|
"raylib",
|
||||||
"zeromq",
|
"zeromq",
|
||||||
"zstd",
|
"zstd",
|
||||||
|
|||||||
159
qt5/build.sh
Executable file
159
qt5/build.sh
Executable file
@@ -0,0 +1,159 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
QT_VERSION="5.15.18"
|
||||||
|
QT_TAG="v${QT_VERSION}-lts-lgpl"
|
||||||
|
INSTALL_DIR="$DIR/qt5/install"
|
||||||
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
|
||||||
|
# Install build dependencies
|
||||||
|
if [[ "$(uname)" == "Linux" ]]; then
|
||||||
|
if command -v dnf &>/dev/null; then
|
||||||
|
dnf install -y \
|
||||||
|
mesa-libGL-devel \
|
||||||
|
fontconfig-devel \
|
||||||
|
freetype-devel \
|
||||||
|
libxcb-devel \
|
||||||
|
xcb-util-devel \
|
||||||
|
xcb-util-image-devel \
|
||||||
|
xcb-util-keysyms-devel \
|
||||||
|
xcb-util-renderutil-devel \
|
||||||
|
xcb-util-wm-devel \
|
||||||
|
libxkbcommon-devel \
|
||||||
|
libxkbcommon-x11-devel \
|
||||||
|
libX11-devel \
|
||||||
|
perl-IPC-Cmd
|
||||||
|
elif command -v apt-get &>/dev/null; then
|
||||||
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
|
apt-get update && apt-get install -y \
|
||||||
|
libgl-dev \
|
||||||
|
libfontconfig1-dev libfreetype-dev \
|
||||||
|
libxcb1-dev libxcb-glx0-dev libxcb-keysyms1-dev \
|
||||||
|
libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev \
|
||||||
|
libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev \
|
||||||
|
libxcb-randr0-dev libxcb-render-util0-dev \
|
||||||
|
libxcb-xinerama0-dev libxcb-xkb-dev \
|
||||||
|
libxkbcommon-dev libxkbcommon-x11-dev \
|
||||||
|
libx11-xcb-dev
|
||||||
|
else
|
||||||
|
sudo apt-get update && sudo apt-get install -y \
|
||||||
|
libgl-dev \
|
||||||
|
libfontconfig1-dev libfreetype-dev \
|
||||||
|
libxcb1-dev libxcb-glx0-dev libxcb-keysyms1-dev \
|
||||||
|
libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev \
|
||||||
|
libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev \
|
||||||
|
libxcb-randr0-dev libxcb-render-util0-dev \
|
||||||
|
libxcb-xinerama0-dev libxcb-xkb-dev \
|
||||||
|
libxkbcommon-dev libxkbcommon-x11-dev \
|
||||||
|
libx11-xcb-dev
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clone/update qtbase
|
||||||
|
if [ ! -d "qtbase-src/.git" ]; then
|
||||||
|
rm -rf qtbase-src
|
||||||
|
git clone --depth 1 https://code.qt.io/qt/qtbase.git qtbase-src
|
||||||
|
fi
|
||||||
|
git -C qtbase-src fetch --depth 1 origin "$QT_TAG"
|
||||||
|
git -C qtbase-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
|
# Clean install dir and build artifacts to avoid stale cache issues
|
||||||
|
rm -rf "$INSTALL_DIR"
|
||||||
|
|
||||||
|
# Build qtbase (disable modules cabana doesn't need)
|
||||||
|
cd qtbase-src
|
||||||
|
make distclean 2>/dev/null || true
|
||||||
|
./configure \
|
||||||
|
-release \
|
||||||
|
-prefix "$INSTALL_DIR" \
|
||||||
|
-opensource -confirm-license \
|
||||||
|
-nomake examples \
|
||||||
|
-nomake tests \
|
||||||
|
-no-dbus \
|
||||||
|
-no-icu \
|
||||||
|
-opengl desktop
|
||||||
|
make -j"$NJOBS"
|
||||||
|
make install
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
# Clone/update qtcharts
|
||||||
|
if [ ! -d "qtcharts-src/.git" ]; then
|
||||||
|
rm -rf qtcharts-src
|
||||||
|
git clone --depth 1 https://code.qt.io/qt/qtcharts.git qtcharts-src
|
||||||
|
fi
|
||||||
|
git -C qtcharts-src fetch --depth 1 origin "$QT_TAG"
|
||||||
|
git -C qtcharts-src checkout --force FETCH_HEAD
|
||||||
|
|
||||||
|
# Build qtcharts
|
||||||
|
cd qtcharts-src
|
||||||
|
make distclean 2>/dev/null || true
|
||||||
|
"$INSTALL_DIR/bin/qmake"
|
||||||
|
make -j"$NJOBS"
|
||||||
|
make install
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
|
# Cleanup (don't let individual failures kill the build)
|
||||||
|
set +e
|
||||||
|
rm -rf "$INSTALL_DIR/doc" "$INSTALL_DIR/mkspecs" "$INSTALL_DIR/lib/cmake" "$INSTALL_DIR/lib/pkgconfig"
|
||||||
|
find "$INSTALL_DIR/lib" -name '*.prl' -delete 2>/dev/null || true
|
||||||
|
find "$INSTALL_DIR/lib" -name '*.la' -delete 2>/dev/null || true
|
||||||
|
|
||||||
|
# Remove unnecessary binaries (qmake alone is 28MB, only needed for qtcharts build above)
|
||||||
|
find "$INSTALL_DIR/bin" -not -name moc -not -name rcc -not -name uic -not -type d -delete 2>/dev/null || true
|
||||||
|
|
||||||
|
if [[ "$(uname)" == "Linux" ]]; then
|
||||||
|
# Remove unnecessary shared libs (keep only what cabana links)
|
||||||
|
KEEP_LIBS="Qt5Core Qt5Gui Qt5Widgets Qt5Charts Qt5OpenGL Qt5XcbQpa Qt5EglFSDeviceIntegration Qt5EglFsKmsSupport"
|
||||||
|
for f in "$INSTALL_DIR/lib/"lib*.so; do
|
||||||
|
name="${f##*/lib}"; name="${name%.so}"
|
||||||
|
echo "$KEEP_LIBS" | grep -qw "$name" || rm -f "$INSTALL_DIR/lib/lib${name}".so*
|
||||||
|
done
|
||||||
|
|
||||||
|
# Remove unnecessary include dirs
|
||||||
|
KEEP_INCLUDES="QtCore QtGui QtWidgets QtCharts QtOpenGL"
|
||||||
|
for d in "$INSTALL_DIR/include/"*/; do
|
||||||
|
name="$(basename "$d")"
|
||||||
|
echo "$KEEP_INCLUDES" | grep -qw "$name" || rm -rf "$d"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Remove static libs
|
||||||
|
find "$INSTALL_DIR/lib" -maxdepth 1 -name '*.a' -delete
|
||||||
|
|
||||||
|
# Replace symlinks with copies (wheels can't store symlinks)
|
||||||
|
find "$INSTALL_DIR" -type l | while read -r link; do
|
||||||
|
target="$(readlink -f "$link")"
|
||||||
|
if [ -f "$target" ]; then
|
||||||
|
rm "$link"; cp "$target" "$link"
|
||||||
|
elif [ -d "$target" ]; then
|
||||||
|
rm "$link"; cp -r "$target" "$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Deduplicate versioned .so: keep only .so and .so.5 (SONAME)
|
||||||
|
find "$INSTALL_DIR/lib" -maxdepth 1 -name 'lib*.so.5.15.18' -delete
|
||||||
|
find "$INSTALL_DIR/lib" -maxdepth 1 -name 'lib*.so.5.15' -delete
|
||||||
|
|
||||||
|
# Strip
|
||||||
|
find "$INSTALL_DIR" -type f \( -name '*.so*' -o -path '*/bin/*' \) -exec strip --strip-unneeded {} + 2>/dev/null || true
|
||||||
|
else
|
||||||
|
# macOS: replace symlinks, strip frameworks
|
||||||
|
find "$INSTALL_DIR" -type l | while read -r link; do
|
||||||
|
target="$(readlink -f "$link")"
|
||||||
|
if [ -f "$target" ]; then
|
||||||
|
rm "$link"; cp "$target" "$link"
|
||||||
|
elif [ -d "$target" ]; then
|
||||||
|
rm "$link"; cp -r "$target" "$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
find "$INSTALL_DIR" -type f -name '*.dylib' -exec strip -x {} + 2>/dev/null || true
|
||||||
|
find "$INSTALL_DIR/bin" -type f -exec strip -x {} + 2>/dev/null || true
|
||||||
|
find "$INSTALL_DIR/lib" -maxdepth 1 -name '*.a' -delete 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
set -e
|
||||||
|
echo "Installed Qt5 to $INSTALL_DIR"
|
||||||
|
du -sh "$INSTALL_DIR"
|
||||||
15
qt5/pyproject.toml
Normal file
15
qt5/pyproject.toml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=64", "wheel"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "qt5"
|
||||||
|
version = "5.15.18"
|
||||||
|
description = "Qt 5.15 (QtBase + QtCharts)"
|
||||||
|
requires-python = ">=3.8"
|
||||||
|
|
||||||
|
[tool.setuptools.packages.find]
|
||||||
|
include = ["qt5*"]
|
||||||
|
|
||||||
|
[tool.setuptools.package-data]
|
||||||
|
qt5 = ["install/**/*"]
|
||||||
19
qt5/qt5/__init__.py
Normal file
19
qt5/qt5/__init__.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||||
|
BIN_DIR = os.path.join(DIR, "bin")
|
||||||
|
LIB_DIR = os.path.join(DIR, "lib")
|
||||||
|
INCLUDE_DIR = os.path.join(DIR, "include")
|
||||||
|
|
||||||
|
|
||||||
|
def smoketest():
|
||||||
|
assert os.path.isfile(os.path.join(BIN_DIR, "moc")), "moc not found"
|
||||||
|
assert os.path.isfile(os.path.join(BIN_DIR, "rcc")), "rcc not found"
|
||||||
|
import glob
|
||||||
|
import platform
|
||||||
|
if platform.system() == "Darwin":
|
||||||
|
assert os.path.isdir(os.path.join(LIB_DIR, "QtCore.framework")), "QtCore.framework not found"
|
||||||
|
assert os.path.isdir(os.path.join(LIB_DIR, "QtCharts.framework")), "QtCharts.framework not found"
|
||||||
|
else:
|
||||||
|
assert glob.glob(os.path.join(LIB_DIR, "libQt5Core.so*")), "libQt5Core.so not found"
|
||||||
|
assert glob.glob(os.path.join(LIB_DIR, "libQt5Charts.so*")), "libQt5Charts.so not found"
|
||||||
58
qt5/setup.py
Normal file
58
qt5/setup.py
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
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 BuildQt5(build_py):
|
||||||
|
"""Run build.sh to compile Qt5 before collecting package data."""
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
build_script = os.path.join(pkg_dir, "build.sh")
|
||||||
|
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||||
|
|
||||||
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
|
cmdclass = {"build_py": BuildQt5}
|
||||||
|
|
||||||
|
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()
|
||||||
Reference in New Issue
Block a user