Compare commits

...

4 Commits

Author SHA1 Message Date
475fce5fca build(package): fixed xatters issues
macos tar adds xattrs which prevent unpacking on linux. removed these
2026-01-31 11:39:00 -05:00
a3b63a68d1 build(package): added package script
package script auto generates release archive
2026-01-31 11:27:58 -05:00
6a8fcc0290 feat(release): added macos release script 2026-01-31 11:12:52 -05:00
2db3d6e666 fix(linux): fixed linux compilation 2026-01-31 10:39:55 -05:00
7 changed files with 250 additions and 4 deletions

6
.gitignore vendored
View File

@@ -101,3 +101,9 @@ output/
.idea/ .idea/
scratch/ scratch/
releases/
stroid-dist/
stroid-universal-dist.tar.gz
stroid-*/
stroid-*.tar.gz

View File

@@ -5,9 +5,10 @@ mfem_cmake_options.add_cmake_defines({
'MFEM_ENABLE_TESTING': 'OFF', 'MFEM_ENABLE_TESTING': 'OFF',
'MFEM_ENABLE_MINIAPPS': 'OFF', 'MFEM_ENABLE_MINIAPPS': 'OFF',
'MFEM_USE_BENCMARK': 'OFF', 'MFEM_USE_BENCMARK': 'OFF',
'BUILD_SHARED_LIBS': 'ON', 'BUILD_SHARED_LIBS': 'OFF',
'CMAKE_SKIP_INSTALL_RULES': 'ON' 'BUILD_STATIC_LIBS': 'ON',
}) })
mfem_cmake_options.set_install(true)
mfem_sp = cmake.subproject( mfem_sp = cmake.subproject(
'mfem', 'mfem',

113
package_release.sh Executable file
View File

@@ -0,0 +1,113 @@
#!/bin/bash
set -e
RELEASE_DIR="releases"
STAGING_DIR="stroid-dist"
REQUIRED_BINARIES=(
"stroid-macos-arm64"
"stroid-linux-x86_64"
"stroid-linux-arm64"
)
for bin in "${REQUIRED_BINARIES[@]}"; do
if [ ! -f "$RELEASE_DIR/$bin" ]; then
echo "Error: Missing binary $RELEASE_DIR/$bin. Run release.sh first."
exit 1
fi
done
chmod +x "$RELEASE_DIR/stroid-macos-arm64"
VERSION_OUTPUT=$("$RELEASE_DIR/stroid-macos-arm64" info -v)
VERSION=$(echo "$VERSION_OUTPUT" | awk '{print $3}')
if [ -z "$VERSION" ]; then
echo "Error: Could not extract version from binary output."
exit 1
fi
TARBALL_NAME="stroid-${VERSION}.tar.gz"
echo "Packaging Stroid version ${VERSION}..."
rm -rf "$STAGING_DIR"
mkdir -p "$STAGING_DIR/bin"
for bin in "${REQUIRED_BINARIES[@]}"; do
cp "$RELEASE_DIR/$bin" "$STAGING_DIR/bin/"
done
cat << 'EOF' > "$STAGING_DIR/install.sh"
#!/bin/bash
set -e
OS=$(uname -s)
ARCH=$(uname -m)
INSTALL_PATH=$1
echo "Detecting system: $OS ($ARCH)"
case "$OS" in
Darwin)
if [ "$ARCH" = "arm64" ]; then
SELECTED_BIN="bin/stroid-macos-arm64"
else
echo "Error: Intel Macs (x86_64) are not supported by this package."
exit 1
fi
;;
Linux)
if [ "$ARCH" = "x86_64" ]; then
SELECTED_BIN="bin/stroid-linux-x86_64"
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
SELECTED_BIN="bin/stroid-linux-arm64"
else
echo "Error: Linux architecture $ARCH is not supported."
exit 1
fi
;;
*)
echo "Error: Operating system $OS is not supported."
exit 1
;;
esac
echo "Verifying binary integrity..."
chmod +x "$SELECTED_BIN"
if ! ./"$SELECTED_BIN" info -v > /dev/null 2>&1; then
echo "Error: The selected binary failed the version check. It may be incompatible with this system's libraries."
exit 1
fi
VERSION_INFO=$(./"$SELECTED_BIN" info -v)
echo "Verification successful: $VERSION_INFO"
if [ -z "$INSTALL_PATH" ]; then
if [ "$EUID" -eq 0 ]; then
INSTALL_PATH="/usr/local/bin"
else
INSTALL_PATH="$HOME/.local/bin"
fi
fi
mkdir -p "$INSTALL_PATH"
echo "Installing to: $INSTALL_PATH/stroid"
cp "$SELECTED_BIN" "$INSTALL_PATH/stroid"
chmod +x "$INSTALL_PATH/stroid"
echo "Installation complete."
if [[ ":$PATH:" != *":$INSTALL_PATH:"* ]]; then
echo "Note: $INSTALL_PATH is not in your PATH. Add it to your shell profile to run 'stroid' from anywhere."
fi
EOF
chmod +x "$STAGING_DIR/install.sh"
export COPYFILE_DISABLE=1
tar -cz --no-xattrs -f "$TARBALL_NAME" -C "$STAGING_DIR" .
echo "Distribution package created: $TARBALL_NAME"
rm -rf "$STAGING_DIR"

44
release.md Normal file
View File

@@ -0,0 +1,44 @@
# Generating Releases
> This document is likely only of interest to developers wishing to build release files. If you wish to use
> stroid, please refer to the main readme instructions.
## Building
Release files can be built on an arm mac using the following commands:
```bash
./release.sh
```
all release files will be placed in the `releases/` folder.
This will construct release files for arm mac, arm linux, and x86_64 linux. These should be
compatible with most systems (linux more recent than 2020 and macOS more recent than 15.0)
For those who wish to build from source see the main readme instructions.
## Packaging
The auto-generated release files are named according to the following convention:
`stroid-<os>-<arch>`, these are all statically linked so they should
just run on system. To distribute these files we want to package them into a single
archive file along with an installation script which will select the correct binary
for the host system. There is a script `package_release.sh` which will do this automatically.
Once the release files have been generated, run the following command:
```bash
./package_release.sh
```
## Uploading
Once the release files have been packaged, they can be uploaded to the github releases page. This can be done manually through the github web interface, or
automatically using the `gh` CLI tool. To upload using the CLI tool, first ensure you have it installed and authenticated with your
github account. Then run the following command:
```bash
gh release create <tag> ./stroid-release.tar.gz
```
Alternatively, you can upload the files manually through the github web interface by navigating to the releases page of
the repository and clicking on "Draft a new release". From there, you can upload the `stroid-release.tar.gz` file and
publish the release.

80
release.sh Executable file
View File

@@ -0,0 +1,80 @@
#!/bin/bash
set -e
# Confirm that the script is being run on a macOS aarch64 host
ARCHITECTURE=$(uname -m)
OS_NAME=$(uname -s)
if [[ "$OS_NAME" != "Darwin" || "$ARCHITECTURE" != "arm64" ]]; then
echo "This release script must be run on a macOS aarch64 host."
exit 1
fi
PROJECT_NAME="stroid"
MACOS_MIN_VERSION="15.0"
OUTPUT_DIR="releases"
# Confirm that Meson and Ninja are installed
if ! command -v meson &> /dev/null || ! command -v ninja &> /dev/null; then
echo "Meson and Ninja are required to build the project."
echo "Please install them via pip:"
echo " pip install meson ninja"
exit 1
fi
# Confirm that the current macOS version meets the minimum requirement
CURRENT_MACOS_VERSION=$(sw_vers -productVersion)
if [[ "$(printf '%s\n%s\n' "$MACOS_MIN_VERSION" "$CURRENT_MACOS_VERSION" | sort -V | head -n1)" != "$MACOS_MIN_VERSION" ]]; then
echo "Current macOS version ($CURRENT_MACOS_VERSION) does not meet the minimum requirement ($MACOS_MIN_VERSION)."
exit 1
fi
X86_IMAGE="quay.io/pypa/manylinux_2_28_x86_64"
ARM_IMAGE="quay.io/pypa/manylinux_2_28_aarch64"
mkdir -p "$OUTPUT_DIR"
echo "Starting release build for $PROJECT_NAME..."
echo "Building for macOS (ARM64, Target >= $MACOS_MIN_VERSION)..."
rm -rf build-mac
export MACOSX_DEPLOYMENT_TARGET=$MACOS_MIN_VERSION
meson setup build-mac \
--buildtype release \
-Dcpp_args="-mmacosx-version-min=$MACOS_MIN_VERSION" \
-Dcpp_link_args="-mmacosx-version-min=$MACOS_MIN_VERSION"
meson compile -C build-mac
cp build-mac/tools/stroid "$OUTPUT_DIR/stroid-macos-arm64"
echo "Building for Linux (x86_64) via Manylinux 2.28..."
docker run --rm --platform linux/amd64 \
-v "$(pwd)":/src -w /src \
$X86_IMAGE /bin/bash -c "
/opt/python/cp311-cp311/bin/pip install meson ninja
export PATH=/opt/python/cp311-cp311/bin:\$PATH
rm -rf build-linux-x86
meson setup build-linux-x86 --buildtype release -Dbuild_tests=false
meson compile -C build-linux-x86
cp build-linux-x86/tools/stroid /src/$OUTPUT_DIR/stroid-linux-x86_64
"
echo "Building for Linux (ARM64) via Manylinux 2.28..."
docker run --rm --platform linux/arm64 \
-v "$(pwd)":/src -w /src \
$ARM_IMAGE /bin/bash -c "
/opt/python/cp311-cp311/bin/pip install meson ninja
export PATH=/opt/python/cp311-cp311/bin:\$PATH
rm -rf build-linux-arm
meson setup build-linux-arm --buildtype release -Dbuild_tests=false
meson compile -C build-linux-arm
cp build-linux-arm/tools/stroid /src/$OUTPUT_DIR/stroid-linux-arm64
"
echo "---"
echo "All binaries generated in /$OUTPUT_DIR"
ls -lh "$OUTPUT_DIR"

View File

@@ -1,4 +1,4 @@
[wrap-git] [wrap-git]
url = https://github.com/4D-STAR/libconfig.git url = https://github.com/4D-STAR/libconfig.git
revision = v2.0.4 revision = v2.0.5
depth = 1 depth = 1

View File

@@ -1,6 +1,7 @@
gtest_dep = dependency('gtest', main: true, required : true) gtest_dep = dependency('gtest', main: true, required : true)
gtest_main = dependency('gtest_main', required: true) gtest_main = dependency('gtest_main', required: true)
gtest_nomain_dep = dependency('gtest', main: false, required : true) gtest_nomain_dep = dependency('gtest', main: false, required : true)
threads_dep = dependency('threads')
# Test files for const # Test files for const
test_sources = [ test_sources = [
@@ -14,6 +15,7 @@ foreach test_file : test_sources
exe_name, exe_name,
test_file, test_file,
dependencies: [ dependencies: [
threads_dep,
stroid_dep, stroid_dep,
gtest_dep, gtest_dep,
gtest_main gtest_main