Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packaging/debian/control/control
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ Architecture: any
Depends: ${shlibs:Depends},
${misc:Depends},
libncurses6,
bash
bash,
ncompress
Description: Modernized classic ncurses multiplayer fantasy war game
ConquerV5 is the modernized version of the classic multiplayer fantasy war game
originally created by Ed Barlow and Adam Bryant between 1987-1992. This version
Expand Down
3 changes: 3 additions & 0 deletions packaging/debian/control/rules
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ override_dh_auto_build:
CFLAGS="-O2 -DNDEBUG -DBSD -DPLATFORM_LINUX -DPLATFORM_UNIX -std=gnu99 -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200112L -fcommon -Wno-implicit-function-declaration" \
CKFLAGS="-O2 -DNDEBUG -DBSD -DPLATFORM_LINUX -DPLATFORM_UNIX -std=gnu99 -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200112L -fcommon -Wno-implicit-function-declaration"


override_dh_auto_install:
# Since the Makefiles don't respect DESTDIR, we need to override the paths
$(MAKE) install \
Expand All @@ -63,6 +64,8 @@ override_dh_auto_install:
BINDIR="$(CURDIR)/debian/conquerv5$(BINDIR)" \
CHOWN="true" \
CHMOD="chmod"
# Manually install missing binaries (like conqsort)
install -D -m755 Auxil/conqsort "$(CURDIR)/debian/conquerv5/usr/bin/conqsort"

override_dh_auto_clean:
# Clean build artifacts
Expand Down
94 changes: 94 additions & 0 deletions packaging/melange/melange.yaml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package:
name: conquerv5
version: PLACEHOLDER_VERSION
epoch: 0
description: "Modernized classic ncurses multiplayer fantasy war game. ConquerV5 brings the 1980s Unix gaming experience to modern systems with cross-platform support."
url: https://github.com/vejeta/conquerv5
copyright:
- license: GPL-3.0-or-later
paths:
- "*"
dependencies:
runtime:
- ncurses
- ncurses-terminfo-base
- bash

environment:
contents:
repositories:
- https://dl-cdn.alpinelinux.org/alpine/edge/main
- https://dl-cdn.alpinelinux.org/alpine/edge/community
packages:
- alpine-baselayout-data
- busybox
- build-base
- ncurses-dev
- make
- sed
- coreutils
- pkgconfig
- gcc
- libc-dev
- bash
- gawk
- groff
- groff-doc
- ghostscript
- ghostscript-fonts

pipeline:
# Fetch local staged tarball instead of git
- uses: fetch
with:
uri: file:///staged/conquerv5-release.tar.gz
extract: true
expected-sha256: PLACEHOLDER_SHA256

# Custom ConquerV5 build and Makefile setup
- runs: |
echo "🗡️ Entering the battlefield… compiling ConquerV5!"


# Environment variables for build
export LOGIN="games"
export PREFIX="/usr"
export DATADIR="/usr/share/conquerv5"
export BINDIR="/usr/bin"
export MAKE="/usr/bin/make"



# Step 1: Set up main Makefile
cp Makefile.top Makefile

# Step 1.1: Remove previous artifacts
$MAKE clean

# Step 2: Generate sub-Makefiles
$MAKE Makefiles LOGIN="$LOGIN" PREFIX="$PREFIX" DATADIR="$DATADIR" BINDIR="$BINDIR" MAKE="/usr/bin/make"

# Step 3: Compile project

# Approach 1: Replace the entire CFLAGS line, so it can compile in ALPINE.

find . -name "Makefile" -exec sed -i '/^CFLAGS.*=.*DPLATFORM_LINUX/s/$/ -D_DEFAULT_SOURCE -D_BSD_SOURCE/' {} \;
$MAKE build BUILD=release LOGIN="$LOGIN" PREFIX="$PREFIX" DATADIR="$DATADIR" BINDIR="$BINDIR"

# Step 4: Manual installation respecting DESTDIR
mkdir -p ${{targets.destdir}}/usr/bin
mkdir -p ${{targets.destdir}}/usr/share/conquerv5

find . -name "conquer" -type f -executable -exec cp {} ${{targets.destdir}}/usr/bin/ \;
find . -name "conqrun" -type f -executable -exec cp {} ${{targets.destdir}}/usr/bin/ \;
find . -name "conqsort" -type f -executable -exec cp {} ${{targets.destdir}}/usr/bin/ \;

# Data files
cp Src/nations ${{targets.destdir}}/usr/share/conquerv5/ || true
cp Docs/*.doc ${{targets.destdir}}/usr/share/conquerv5/ || true

# Permissions
chmod 755 ${{targets.destdir}}/usr/bin/conq*
echo "⚔️ ConquerV5 compilation and installation complete!"

- uses: strip
98 changes: 57 additions & 41 deletions scripts/build-melange.sh
Original file line number Diff line number Diff line change
@@ -1,51 +1,67 @@
#!/bin/bash
# ConquerV5 Melange package build script

set -e

# Change to repo root directory
cd "$(dirname "$0")/.."
echo "🏰 Sir Chapi reporting for duty… preparing the ConquerV5 build!"

# Ensure we have the melange configuration
if [ ! -f "packaging/melange/melange.yaml" ]; then
echo "Error: melange.yaml not found in packaging/melange/"
exit 1
fi
SCRIPT_DIR="$(dirname "$0")"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$REPO_ROOT"

VERSION=5.0
BUILD_DIR="$REPO_ROOT/build"
TARBALL="$BUILD_DIR/conquerv5-release.tar.gz"
MELANGE_YAML="$BUILD_DIR/melange.yaml"
OUT_DIR="$PWD/packages/alpine/conquerv5-${VERSION}"

rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR"

# Pack the source (content-only)
tar -C "$REPO_ROOT/gpl-release" -czf "$TARBALL" .

# Compute SHA256
SHA256=$(sha256sum "$TARBALL" | awk '{print $1}')
echo "🔒 Calculated SHA256: $SHA256"

# Generate final YAML from template
sed -e "s/PLACEHOLDER_SHA256/$SHA256/" \
-e "s/PLACEHOLDER_VERSION/$VERSION/" \
"$REPO_ROOT/packaging/melange/melange.yaml.template" > "$MELANGE_YAML"

# Create packages directory
mkdir -p packages/alpine

echo "=== Building ConquerV5 APK package with Melange ==="

# Install melange if not available
if ! command -v melange &> /dev/null; then
echo "Installing melange..."
# Using Docker with melange
docker run --privileged --rm \
-v "$PWD":/work \
-w /work \
cgr.dev/chainguard/melange build \
--arch=x86_64 \
--out-dir=/work/packages/alpine \
packaging/melange/melange.yaml
# Run Melange build
docker run --privileged --rm \
-v "$BUILD_DIR":/staged:ro \
-v "$OUT_DIR":/out \
cgr.dev/chainguard/melange build \
--arch=x86_64 \
--out-dir=/out \
/staged/$(basename "$MELANGE_YAML")

# ===============================
# 🛡️ Generate Checksums
# ===============================
echo "🛡️ Generating checksums for artifacts…"

# Detect if running in GitHub Actions
if [ -n "$GITHUB_WORKSPACE" ]; then
# Safer location inside CI
CHECKSUM_DIR="$GITHUB_WORKSPACE/checksums"
else
# Use local melange installation
melange build \
--arch=x86_64 \
--out-dir=packages/alpine \
packaging/melange/melange.yaml
# Local builds: put checksums alongside packages
CHECKSUM_DIR="$OUT_DIR"
fi

echo "=== APK package built successfully! ==="
echo "Package location: packages/alpine/"
ls -la packages/alpine/
mkdir -p "$CHECKSUM_DIR"

# Verify the package was created
APK_COUNT=$(find packages/alpine/ -name "*.apk" | wc -l)
if [ "$APK_COUNT" -eq 0 ]; then
echo "ERROR: No APK packages were created!"
exit 1
fi
# Generate checksums for all built APKs
find "$OUT_DIR" -type f -name "*.apk" -exec sha256sum {} \; > "$CHECKSUM_DIR/checksums.txt"

echo "✅ Checksums written to: $CHECKSUM_DIR/checksums.txt"


# Cleanup
rm -f "$MELANGE_YAML" "$TARBALL"

echo "✅ Found $APK_COUNT APK package(s)"
find packages/alpine/ -name "*.apk" -exec ls -lh {} \;
echo "🏁 ConquerV5 package built successfully in $OUT_DIR"
ls -la "$OUT_DIR"
echo "🎉 All glory to Sir Chapi!"
2 changes: 1 addition & 1 deletion scripts/test-alpine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ docker run --rm -it --platform=linux/amd64 \
-v "$ABSOLUTE_MOUNT_DIR":/work \
alpine:latest sh -c "
# Install dependencies and the game
apk add --no-cache ncurses-terminfo-base ncurses
apk add --no-cache ncurses-terminfo-base ncurses ncompress
apk add --allow-untrusted /work/$APK_BASENAME

# Debug what got installed
Expand Down