|
1 | 1 | # -*- mode: python ; coding: utf-8 -*- |
2 | | -"""Single parameterized PyInstaller spec for the standalone macOS/Linux/Windows builds. |
3 | | -
|
4 | | -Run from the repo root, normally via the orchestrator: |
5 | | -``python scripts/standalone/build.py --platform {macos,linux,windows}`` (which |
6 | | -exports ``AUDIOMUSE_BUILD_TARGET`` and invokes |
7 | | -``pyinstaller AudioMuse-AI.spec --noconfirm``). A bare |
8 | | -``pyinstaller AudioMuse-AI.spec`` also works for a developer -- the target then |
9 | | -falls back to the host OS (PyInstaller cannot cross-compile, so the host is the |
10 | | -only valid target). |
11 | | -
|
12 | | -This replaces the three near-identical per-platform specs. Everything that |
13 | | -differs per platform lives in ``scripts/standalone/config.py`` (the ``PLATFORMS`` |
14 | | -table); everything identical is hardcoded below. The config module is loaded by |
15 | | -file path via ``importlib`` so ``scripts`` never becomes an importable package |
16 | | -that the analysis could pull into the frozen app. |
17 | | -
|
18 | | -Rationale preserved from the old specs (do not regress): |
19 | | -
|
20 | | -* ``strip=False`` in BOTH ``EXE`` and ``COLLECT``. Most native deps are manylinux |
21 | | - wheels whose shared libraries were already rewritten by auditwheel/patchelf |
22 | | - (mangled sonames, injected RPATHs); running ``strip`` over a patchelf-modified |
23 | | - ELF breaks it -- pgserver's initdb/psql SIGSEGV at load, scipy's OpenBLAS fails |
24 | | - with "ELF load command address/offset not page-aligned". On Windows stripping |
25 | | - ``.pyd`` files can break them too. Stripping would save a few hundred MB, but a |
26 | | - corrupted bundle does not start at all, so correctness wins. |
27 | | -
|
28 | | -* Embedded PostgreSQL sourcing (``USE_PGSERVER``): the pgserver wheel on |
29 | | - Windows/macOS and Linux x86_64; a from-source PostgreSQL tree bundled under |
30 | | - ``pgsql/`` on Linux aarch64 (no arm64 wheel). Windows tries the wheel and falls |
31 | | - back to the from-source tree if the wheel is not importable at build time. |
32 | | -
|
33 | | -* pgserver ships only plpgsql + pgvector; the schema needs ``unaccent`` and |
34 | | - ``pg_trgm``. Those contrib modules are vendored (compiled against pgserver's |
35 | | - exact PG ABI) and grafted into the bundled pgserver tree. ``collect_data_files`` |
36 | | - EXCLUDES shared libraries, so the loadable modules under |
37 | | - ``pginstall/lib/postgresql`` are dropped from the wheel copy; the build's |
38 | | - ``verify_pgserver_bundle`` step restores the complete tree and smoke-tests |
39 | | - ``initdb`` before packaging. |
40 | | -
|
41 | | -* The Windows tray-launch fix does a function-level ``import |
42 | | - pgserver.postgres_server`` (to patch ``pg_ctl``); it is listed as an explicit |
43 | | - hidden import for Windows so the frozen bundle keeps that submodule. |
44 | | -""" |
45 | | - |
46 | 2 | import glob |
47 | 3 | import importlib.util |
48 | 4 | import os |
|
0 commit comments