Skip to content

Commit c93066c

Browse files
4cecoderclaude
andcommitted
Add comprehensive packaging support for 12 package managers
New packaging/ directory with ready-to-use templates: Linux distro packages: - packaging/gentoo/ - Portage ebuilds (moved from root) - packaging/aur/ - Arch Linux PKGBUILD - packaging/debian/ - .deb build files + script - packaging/rpm/ - Fedora/RHEL spec file - packaging/alpine/ - APKBUILD - packaging/nix/ - Flake + default.nix Universal Linux: - packaging/flatpak/ - Flatpak manifest - packaging/snap/ - Snapcraft YAML - packaging/appimage/ - Build script macOS: - packaging/homebrew/ - Homebrew formula Windows: - packaging/scoop/ - Scoop manifest - packaging/chocolatey/ - Chocolatey nuspec + install scripts docs/packaging.md - Complete rewrite with instructions for all formats 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent bfdface commit c93066c

23 files changed

Lines changed: 1265 additions & 376 deletions

docs/packaging.md

Lines changed: 388 additions & 376 deletions
Large diffs are not rendered by default.

packaging/alpine/APKBUILD

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Contributor: 4cecoder <4cecoder@users.noreply.github.com>
2+
# Maintainer: 4cecoder <4cecoder@users.noreply.github.com>
3+
pkgname=imtools
4+
pkgver=1.0.0
5+
pkgrel=0
6+
pkgdesc="Fast image manipulation CLI tool written in Zig"
7+
url="https://github.com/4cecoder/imtools"
8+
arch="all"
9+
license="MIT"
10+
# Zig must be installed from edge/testing or manually
11+
makedepends="zig"
12+
subpackages="$pkgname-doc"
13+
source="$pkgname-$pkgver.tar.gz::https://github.com/4cecoder/imtools/archive/v$pkgver.tar.gz"
14+
15+
build() {
16+
zig build -Doptimize=ReleaseSafe
17+
}
18+
19+
check() {
20+
./zig-out/bin/imtools help
21+
}
22+
23+
package() {
24+
install -Dm755 zig-out/bin/imtools "$pkgdir"/usr/bin/imtools
25+
install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
26+
install -Dm644 README.md "$pkgdir"/usr/share/doc/$pkgname/README.md
27+
28+
install -d "$pkgdir"/usr/share/doc/$pkgname/docs
29+
cp -r docs/* "$pkgdir"/usr/share/doc/$pkgname/docs/
30+
}
31+
32+
sha512sums="
33+
REPLACE_WITH_ACTUAL_SHA512 imtools-1.0.0.tar.gz
34+
"
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
#!/bin/bash
2+
# Build AppImage for imtools
3+
# Requirements: zig, appimagetool (or linuxdeploy)
4+
#
5+
# Usage:
6+
# ./build-appimage.sh
7+
# ./build-appimage.sh --arch aarch64 # Cross-compile for ARM64
8+
9+
set -e
10+
11+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
13+
BUILD_DIR="$PROJECT_ROOT/build-appimage"
14+
APPDIR="$BUILD_DIR/AppDir"
15+
VERSION="${VERSION:-1.0.0}"
16+
ARCH="${ARCH:-x86_64}"
17+
18+
# Parse arguments
19+
while [[ $# -gt 0 ]]; do
20+
case $1 in
21+
--arch)
22+
ARCH="$2"
23+
shift 2
24+
;;
25+
*)
26+
echo "Unknown option: $1"
27+
exit 1
28+
;;
29+
esac
30+
done
31+
32+
echo "Building imtools AppImage v${VERSION} for ${ARCH}"
33+
34+
# Clean previous build
35+
rm -rf "$BUILD_DIR"
36+
mkdir -p "$APPDIR/usr/bin"
37+
mkdir -p "$APPDIR/usr/share/applications"
38+
mkdir -p "$APPDIR/usr/share/icons/hicolor/256x256/apps"
39+
mkdir -p "$APPDIR/usr/share/doc/imtools"
40+
41+
# Build imtools
42+
cd "$PROJECT_ROOT"
43+
case $ARCH in
44+
x86_64)
45+
zig build -Doptimize=ReleaseSafe -Dtarget=x86_64-linux-musl
46+
;;
47+
aarch64)
48+
zig build -Doptimize=ReleaseSafe -Dtarget=aarch64-linux-musl
49+
;;
50+
*)
51+
echo "Unsupported architecture: $ARCH"
52+
exit 1
53+
;;
54+
esac
55+
56+
# Copy binary
57+
cp zig-out/bin/imtools "$APPDIR/usr/bin/"
58+
chmod +x "$APPDIR/usr/bin/imtools"
59+
60+
# Copy documentation
61+
cp README.md LICENSE "$APPDIR/usr/share/doc/imtools/"
62+
cp -r docs "$APPDIR/usr/share/doc/imtools/"
63+
64+
# Create .desktop file
65+
cat > "$APPDIR/usr/share/applications/imtools.desktop" << 'EOF'
66+
[Desktop Entry]
67+
Type=Application
68+
Name=imtools
69+
GenericName=Image Tools
70+
Comment=Fast image manipulation CLI tool
71+
Exec=imtools %F
72+
Icon=imtools
73+
Categories=Graphics;Utility;
74+
Terminal=true
75+
MimeType=image/png;image/jpeg;image/gif;image/bmp;image/webp;
76+
Keywords=image;wallpaper;duplicate;convert;sort;
77+
EOF
78+
79+
# Copy desktop file to AppDir root (required by AppImage)
80+
cp "$APPDIR/usr/share/applications/imtools.desktop" "$APPDIR/"
81+
82+
# Create simple icon (placeholder - replace with actual icon)
83+
cat > "$APPDIR/usr/share/icons/hicolor/256x256/apps/imtools.svg" << 'EOF'
84+
<?xml version="1.0" encoding="UTF-8"?>
85+
<svg width="256" height="256" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg">
86+
<rect width="256" height="256" rx="32" fill="#2d3748"/>
87+
<text x="128" y="160" font-family="monospace" font-size="120" font-weight="bold" fill="#48bb78" text-anchor="middle">im</text>
88+
</svg>
89+
EOF
90+
91+
# Create symlink for icon at root
92+
ln -sf usr/share/icons/hicolor/256x256/apps/imtools.svg "$APPDIR/imtools.svg"
93+
94+
# Create AppRun script
95+
cat > "$APPDIR/AppRun" << 'EOF'
96+
#!/bin/bash
97+
SELF=$(readlink -f "$0")
98+
HERE=${SELF%/*}
99+
export PATH="${HERE}/usr/bin:${PATH}"
100+
exec "${HERE}/usr/bin/imtools" "$@"
101+
EOF
102+
chmod +x "$APPDIR/AppRun"
103+
104+
# Download appimagetool if not available
105+
APPIMAGETOOL="$BUILD_DIR/appimagetool"
106+
if ! command -v appimagetool &> /dev/null && [ ! -f "$APPIMAGETOOL" ]; then
107+
echo "Downloading appimagetool..."
108+
case $ARCH in
109+
x86_64)
110+
TOOL_ARCH="x86_64"
111+
;;
112+
aarch64)
113+
TOOL_ARCH="aarch64"
114+
;;
115+
esac
116+
wget -q "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-${TOOL_ARCH}.AppImage" -O "$APPIMAGETOOL"
117+
chmod +x "$APPIMAGETOOL"
118+
fi
119+
120+
# Build AppImage
121+
cd "$BUILD_DIR"
122+
if command -v appimagetool &> /dev/null; then
123+
ARCH=$ARCH appimagetool AppDir "imtools-${VERSION}-${ARCH}.AppImage"
124+
else
125+
ARCH=$ARCH "$APPIMAGETOOL" AppDir "imtools-${VERSION}-${ARCH}.AppImage"
126+
fi
127+
128+
echo ""
129+
echo "AppImage created: $BUILD_DIR/imtools-${VERSION}-${ARCH}.AppImage"
130+
echo ""
131+
echo "To test:"
132+
echo " chmod +x imtools-${VERSION}-${ARCH}.AppImage"
133+
echo " ./imtools-${VERSION}-${ARCH}.AppImage help"

packaging/aur/PKGBUILD

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Maintainer: 4cecoder <4cecoder@users.noreply.github.com>
2+
pkgname=imtools
3+
pkgver=1.0.0
4+
pkgrel=1
5+
pkgdesc="Fast image manipulation CLI tool written in Zig"
6+
arch=('x86_64' 'aarch64')
7+
url="https://github.com/4cecoder/imtools"
8+
license=('MIT')
9+
makedepends=('zig')
10+
optdepends=(
11+
'ffmpeg: for convert-to-png and download commands'
12+
'curl: for download and sort commands'
13+
'ollama: for AI-powered image sorting'
14+
)
15+
source=("$pkgname-$pkgver.tar.gz::https://github.com/4cecoder/imtools/archive/v$pkgver.tar.gz")
16+
sha256sums=('SKIP')
17+
18+
build() {
19+
cd "$pkgname-$pkgver"
20+
zig build -Doptimize=ReleaseSafe
21+
}
22+
23+
check() {
24+
cd "$pkgname-$pkgver"
25+
./zig-out/bin/imtools help
26+
}
27+
28+
package() {
29+
cd "$pkgname-$pkgver"
30+
install -Dm755 zig-out/bin/imtools "$pkgdir/usr/bin/imtools"
31+
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
32+
install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
33+
34+
# Install documentation
35+
install -d "$pkgdir/usr/share/doc/$pkgname/docs"
36+
cp -r docs/* "$pkgdir/usr/share/doc/$pkgname/docs/"
37+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
3+
<metadata>
4+
<id>imtools</id>
5+
<version>1.0.0</version>
6+
<title>imtools</title>
7+
<authors>4cecoder</authors>
8+
<owners>4cecoder</owners>
9+
<licenseUrl>https://github.com/4cecoder/imtools/blob/main/LICENSE</licenseUrl>
10+
<projectUrl>https://github.com/4cecoder/imtools</projectUrl>
11+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
12+
<description>Fast image manipulation CLI tool written in Zig.
13+
14+
Features:
15+
- Flatten nested image directories
16+
- Find and remove duplicate images (SHA256)
17+
- Delete portrait-oriented images
18+
- Batch convert images to PNG (requires ffmpeg)
19+
- Download wallpapers from wallhaven.cc
20+
- AI-powered image sorting via Ollama
21+
22+
No runtime dependencies for core features. Optional: ffmpeg, curl, ollama.</description>
23+
<summary>Fast image manipulation CLI tool</summary>
24+
<releaseNotes>https://github.com/4cecoder/imtools/releases/tag/v1.0.0</releaseNotes>
25+
<tags>image wallpaper cli tool zig duplicate convert sort ai</tags>
26+
<packageSourceUrl>https://github.com/4cecoder/imtools/tree/main/packaging/chocolatey</packageSourceUrl>
27+
<docsUrl>https://github.com/4cecoder/imtools/tree/main/docs</docsUrl>
28+
<bugTrackerUrl>https://github.com/4cecoder/imtools/issues</bugTrackerUrl>
29+
</metadata>
30+
<files>
31+
<file src="tools\**" target="tools" />
32+
</files>
33+
</package>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
$ErrorActionPreference = 'Stop'
2+
3+
$packageName = 'imtools'
4+
$url64 = 'https://github.com/4cecoder/imtools/releases/download/v1.0.0/imtools-1.0.0-windows-x86_64.zip'
5+
$checksum64 = 'REPLACE_WITH_ACTUAL_SHA256'
6+
$checksumType64 = 'sha256'
7+
8+
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
9+
10+
$packageArgs = @{
11+
packageName = $packageName
12+
unzipLocation = $toolsDir
13+
url64bit = $url64
14+
checksum64 = $checksum64
15+
checksumType64 = $checksumType64
16+
}
17+
18+
Install-ChocolateyZipPackage @packageArgs
19+
20+
Write-Host ""
21+
Write-Host "imtools has been installed!" -ForegroundColor Green
22+
Write-Host ""
23+
Write-Host "Optional dependencies for full functionality:"
24+
Write-Host " choco install ffmpeg # for convert-to-png and download commands"
25+
Write-Host ""
26+
Write-Host "For AI-powered sorting, install Ollama from https://ollama.ai"
27+
Write-Host ""
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
$ErrorActionPreference = 'Stop'
2+
3+
$packageName = 'imtools'
4+
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
5+
6+
# Remove the executable
7+
$exePath = Join-Path $toolsDir 'imtools.exe'
8+
if (Test-Path $exePath) {
9+
Remove-Item $exePath -Force
10+
}
11+
12+
Write-Host "imtools has been uninstalled." -ForegroundColor Green

packaging/debian/build-deb.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
# Build Debian package for imtools
3+
# Requirements: dpkg-dev, debhelper, zig
4+
#
5+
# Usage:
6+
# ./build-deb.sh
7+
8+
set -e
9+
10+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
11+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
12+
VERSION="${VERSION:-1.0.0}"
13+
BUILD_DIR="$PROJECT_ROOT/build-deb"
14+
15+
echo "Building imtools Debian package v${VERSION}"
16+
17+
# Clean and create build directory
18+
rm -rf "$BUILD_DIR"
19+
mkdir -p "$BUILD_DIR/imtools-${VERSION}"
20+
21+
# Copy source files
22+
cp -r "$PROJECT_ROOT"/{src,build.zig,README.md,LICENSE,docs} "$BUILD_DIR/imtools-${VERSION}/"
23+
cp -r "$SCRIPT_DIR/debian" "$BUILD_DIR/imtools-${VERSION}/"
24+
25+
# Build
26+
cd "$BUILD_DIR/imtools-${VERSION}"
27+
dpkg-buildpackage -us -uc -b
28+
29+
echo ""
30+
echo "Debian package created in: $BUILD_DIR/"
31+
ls -la "$BUILD_DIR"/*.deb
32+
33+
echo ""
34+
echo "To install:"
35+
echo " sudo dpkg -i $BUILD_DIR/imtools_${VERSION}-1_amd64.deb"

packaging/debian/debian/changelog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
imtools (1.0.0-1) unstable; urgency=medium
2+
3+
* Initial release.
4+
* Features: flatten, find-duplicates, delete-portrait, remove-empty-dirs,
5+
convert-to-png, download, sort
6+
7+
-- 4cecoder <4cecoder@users.noreply.github.com> Sun, 15 Dec 2024 00:00:00 +0000

packaging/debian/debian/compat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
13

0 commit comments

Comments
 (0)