@jarkkojs/phindex
v1.2.5
Published
Export and normalize digital photos from local, SFTP, and iOS sources
Readme
Phindex
Phindex copies photos from local, SFTP, or iOS sources and renames them
with a date-ordered collision-resistant naming convention
(<timestamp>_<hash>.<ext>).
Supported image formats:
- JPEG
- PNG
- HEIC/HEIF
- AVIF
- WebP
- TIFF/DNG
- Canon CR2/CR3
Installation
npm packages support Linux x64/ARM64, macOS ARM64, and Windows x64/ARM64:
npm install -g @jarkkojs/phindexThe macOS package includes its native libraries and HEIC/AVIF decoding module;
Homebrew is not needed at runtime. The release archive contains bin/phindex,
lib, and the man page; keep these directories together when relocating it.
The minimum supported macOS version is recorded in lib/macos-min-version.txt.
Bundles are ad-hoc signed, not Apple Developer signed or notarized.
Windows packages contain bin/phindex.exe with statically linked dependencies;
no MinGW or separately installed compiler runtime is needed. Release .tar.gz
archives can be extracted with Windows 10/11's tar -xf. Local and SFTP sources
are supported; iOS access requires a matching libimobiledevice DLL and its
non-system dependencies beside the executable.
Building
apt install build-essential cmake pkg-config \
libexiv2-dev libvips-dev libssh2-1-dev libxxhash-dev
cmake -S . -B build
cmake --build build --parallelThe binary lands in build/phindex. Run make help for available Makefile
targets.
On Apple Silicon, install Xcode Command Line Tools and the Homebrew dependencies:
brew install cmake pkg-config exiv2 vips libssh2 xxhash libimobiledevice dylibbundler
make allmake package-macos builds the native release archive from a clean HEAD.
Build on the oldest macOS version you intend to support, with dependencies built
for that version; the bundle's minimum is the highest requirement across all its
Mach-O files. MACOSX_DEPLOYMENT_TARGET alone cannot lower dependency requirements.
Windows
Windows x64 cross-builds with a MinGW-w64 toolchain and static vcpkg
dependencies (exiv2[bmff], libvips, libssh2, xxhash) under
$VCPKG_ROOT/installed/x64-mingw-static:
cmake -S . -B build-win -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=cross/win32-x64.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build build-wincross/win32-arm64.cmake builds ARM64 with LLVM MinGW. Build its dependencies
with cross/Containerfile.windows-arm64, which pins LLVM MinGW and vcpkg and
uses the arm64-windows-llvm triplet. Set PHINDEX_WINDOWS_ROOT to that prefix
when building outside the image; use the same LLVM MinGW toolchain for the
application and its dependencies. The pinned builder patches Exiv2's missing
<ctime> include and vcpkg's Linux host-architecture detection.
scripts/verify-windows.sh builds both builder images and links both Windows
executables. It runs x64 under Wine against a native build (HOST_BIN,
build/phindex by default), comparing copied bytes, destination names, predicted
names, skip reasons and statistics. On native ARM64 Linux it also runs the ARM64
executable under ARM64 Wine with the same checks. The fixture includes Unicode
names and paths longer than 260 characters. ARM64 is always link-checked and
checked for compiler-runtime DLL dependencies; on an x64 builder, ARM64 runtime
validation is explicitly skipped. Wine validation is not a native Windows test.
CONTAINER=container HOST_BIN=.cache/ci-build/phindex scripts/verify-windows.shThe ARM64 builder runs on the host's Linux architecture (linux/arm64 or
linux/amd64); override it with WINDOWS_ARM64_BUILDER_PLATFORM. Set
WINDOWS_SKIP_IMAGE_BUILD=1 to reuse already-built images without skipping
executable builds or checks.
make package-windows builds both Windows bundles from a clean HEAD using those
builder images, strips the executables, rejects non-system DLL imports, and
runs a Wine version check (ARM64 requires a native ARM64 Linux builder). Outputs
are artifacts/phindex-<version>-win32-{x64,arm64}.tar.gz with checksum and commit
sidecars, and the corresponding npm/win32-* bundles. WINDOWS_JOBS and
WINDOWS_MEMORY control container resources. To check the packaged executables
with the existing copy and dry-run parity fixtures, set WINDOWS_X64_BINARY and
WINDOWS_ARM64_BINARY to their repository-relative paths when invoking
scripts/verify-windows.sh.
Container
Build the OCI container image using Docker, Podman, or Apple container:
# Build with default container engine (docker)
./scripts/build.sh
# Or with a specific container engine:
CONTAINER=container ./scripts/build.shRun phindex by bind-mounting the source and destination directories:
docker run --rm \
--mount type=bind,source=/path/to/photos,target=/data/src,readonly \
--mount type=bind,source=/path/to/output,target=/data/dst \
phindex -v /data/src /data/dstReleases
Create a signed release tag with scripts/release.sh <version>, then push the
commit and tag. Run make ci, make package, and make publish VERSION=<version>
from a clean checkout. On Apple Silicon, make package builds both Linux
AppImages and Windows bundles in containers and the native macOS archive. For
separate builders, run make package-macos on Apple Silicon and make package
on Linux, then collect artifacts/ and the generated npm/*/bin, lib, and
share directories in the publishing checkout. All artifacts must come from
the same release commit.
Linux packaging containers default to 2 CPUs and 4 GiB of memory; override these
with PACKAGE_CPUS and PACKAGE_MEMORY. Build parallelism follows PACKAGE_CPUS.
make publish validates the tagged AppImages, macOS bundle, and both Windows
bundles, stages them and the six npm package tarballs in GitLab generic package
storage, and dispatches the publish-npm pipeline on GitLab.com shared runners.
Only that pipeline publishes to npm, using OIDC and provenance; no npm publishing
token is needed locally or in CI. Each package's npm trusted publisher must
authorize jarkkojs/phindex,
.gitlab-ci.yml, and direct npm publish.
Bootstrap new platform packages and configure their trusted publishers before
the first release that includes them. Windows npm support requires a new
root-package version; existing npm versions and release tags are immutable.
After make package-windows, reserve both Windows package names without
consuming the release version or changing the checkout:
npm login --registry=https://registry.npmjs.org
for platform in win32-x64 win32-arm64; do
tmp="$(mktemp -d)"
cp -R "npm/$platform/." "$tmp/"
npm --prefix "$tmp" version 0.0.0-bootstrap --no-git-tag-version --ignore-scripts
npm publish "$tmp" --access public --tag bootstrap --ignore-scripts \
--provenance=false --registry=https://registry.npmjs.org
rm -rf "$tmp"
doneConfigure a GitLab trusted publisher for each new package: namespace jarkkojs,
project phindex, top-level CI path .gitlab-ci.yml, no environment, and allow
npm publish. Subsequent release versions are published by CI with provenance.
Publication verifies tarball checksums, package metadata, registry integrity,
and the presence of provenance. Once assets are fully staged, rerunning
make publish VERSION=<version> resumes without rebuilding. It also completes
missing release links and skips versions already published with matching
integrity and provenance. Conflicting assets or packages abort the release.
Publish-tooling fixes can be retried from the default branch with
RELEASE_VERSION=<version>, provided release source files still match the tag.
Push those fixes before retrying. The final integrity commit is created locally;
push it separately after publication. Previously published versions without
provenance cannot be retrofitted; use a new version.
Licensing
Phindex is licensed under the GNU General Public License v3.0 or later.
See LICENSE for details.
