diff --git a/Cargo.toml b/Cargo.toml index 9849c35..36c2b7a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ resolver = "2" [workspace.package] edition = "2021" version = "0.1.0" +license = "MIT" [workspace.dependencies] serde = { version = "1", features = ["derive"] } diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f799e9e --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 funman300 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/pkg/solitaire-quest-server/PKGBUILD b/pkg/solitaire-quest-server/PKGBUILD new file mode 100644 index 0000000..d3b4a42 --- /dev/null +++ b/pkg/solitaire-quest-server/PKGBUILD @@ -0,0 +1,63 @@ +# Maintainer: funman300 + +pkgname=solitaire-quest-server +pkgver=0.1.0 +pkgrel=1 +pkgdesc='Self-hosted sync server for Solitaire Quest (stats, achievements, leaderboards)' +url='https://github.com/funman300/solitaire-quest' +license=('MIT') +arch=('x86_64') +makedepends=('cargo' 'rust') +depends=( + 'gcc-libs' + 'glibc' +) +backup=('etc/solitaire-quest-server/server.env') +source=( + "$pkgname-$pkgver.tar.gz::https://github.com/funman300/solitaire-quest/archive/v$pkgver.tar.gz" + 'solitaire-quest-server.service' + 'server.env' +) +b2sums=('SKIP' + 'SKIP' + 'SKIP') + +prepare() { + cd "solitaire-quest-$pkgver" + export RUSTUP_TOOLCHAIN=stable + cargo fetch --locked --target "$(rustc -Vv | grep host | cut -d' ' -f2)" +} + +build() { + cd "solitaire-quest-$pkgver" + export RUSTUP_TOOLCHAIN=stable + export CARGO_TARGET_DIR=target + cargo build --frozen --release -p solitaire_server +} + +check() { + cd "solitaire-quest-$pkgver" + export RUSTUP_TOOLCHAIN=stable + cargo test --frozen -p solitaire_server -p solitaire_sync +} + +package() { + cd "solitaire-quest-$pkgver" + # Binary + install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/solitaire_server" + + # systemd service + install -Dm0644 "$srcdir/solitaire-quest-server.service" \ + "$pkgdir/usr/lib/systemd/system/solitaire-quest-server.service" + + # Environment file (contains JWT_SECRET, DATABASE_URL, SERVER_PORT) + install -Dm0640 "$srcdir/server.env" \ + "$pkgdir/etc/solitaire-quest-server/server.env" + + # License + install -Dm0644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + + # Self-hosting guide + install -Dm0644 README_SERVER.md \ + "$pkgdir/usr/share/doc/$pkgname/README_SERVER.md" +} diff --git a/pkg/solitaire-quest-server/server.env b/pkg/solitaire-quest-server/server.env new file mode 100644 index 0000000..2b0afbe --- /dev/null +++ b/pkg/solitaire-quest-server/server.env @@ -0,0 +1,15 @@ +# Solitaire Quest Server — environment configuration +# This file is installed to /etc/solitaire-quest-server/server.env (mode 0640). +# Edit these values before starting the service. + +# Path to the SQLite database file. +# The directory must be writable by the solitaire-quest service user. +DATABASE_URL=sqlite:///var/lib/solitaire-quest-server/solitaire.db + +# HS256 signing secret for JWT tokens. +# Generate a strong secret with: openssl rand -hex 32 +# REQUIRED — server will refuse to start if unset. +JWT_SECRET=changeme_generate_with_openssl_rand_hex_32 + +# TCP port the server listens on. +SERVER_PORT=8080 diff --git a/pkg/solitaire-quest-server/solitaire-quest-server.service b/pkg/solitaire-quest-server/solitaire-quest-server.service new file mode 100644 index 0000000..8f1c7c7 --- /dev/null +++ b/pkg/solitaire-quest-server/solitaire-quest-server.service @@ -0,0 +1,23 @@ +[Unit] +Description=Solitaire Quest Sync Server +Documentation=https://github.com/funman300/solitaire-quest/blob/main/README_SERVER.md +After=network.target + +[Service] +Type=simple +User=solitaire-quest +Group=solitaire-quest +EnvironmentFile=/etc/solitaire-quest-server/server.env +ExecStart=/usr/bin/solitaire_server +Restart=on-failure +RestartSec=5s + +# Harden the service +NoNewPrivileges=true +PrivateTmp=true +ProtectSystem=strict +ProtectHome=true +ReadWritePaths=/var/lib/solitaire-quest-server + +[Install] +WantedBy=multi-user.target diff --git a/pkg/solitaire-quest/PKGBUILD b/pkg/solitaire-quest/PKGBUILD new file mode 100644 index 0000000..57197c1 --- /dev/null +++ b/pkg/solitaire-quest/PKGBUILD @@ -0,0 +1,46 @@ +# Maintainer: funman300 + +pkgname=solitaire-quest +pkgver=0.1.0 +pkgrel=1 +pkgdesc='Cross-platform Klondike Solitaire with progression, achievements, and optional sync' +url='https://github.com/funman300/solitaire-quest' +license=('MIT') +arch=('x86_64') +makedepends=('cargo' 'rust') +depends=( + 'gcc-libs' + 'glibc' + 'alsa-lib' + 'libxkbcommon' + 'systemd-libs' # libudev.so — required by Bevy input +) +source=("$pkgname-$pkgver.tar.gz::https://github.com/funman300/solitaire-quest/archive/v$pkgver.tar.gz") +b2sums=('SKIP') + +prepare() { + cd "solitaire-quest-$pkgver" + export RUSTUP_TOOLCHAIN=stable + cargo fetch --locked --target "$(rustc -Vv | grep host | cut -d' ' -f2)" +} + +build() { + cd "solitaire-quest-$pkgver" + export RUSTUP_TOOLCHAIN=stable + export CARGO_TARGET_DIR=target + cargo build --frozen --release -p solitaire_app +} + +check() { + cd "solitaire-quest-$pkgver" + export RUSTUP_TOOLCHAIN=stable + # Only test the non-Bevy crates — Bevy integration tests require a GPU/display + # which is not available in a clean build environment. + cargo test --frozen -p solitaire_core -p solitaire_sync +} + +package() { + cd "solitaire-quest-$pkgver" + install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/solitaire_app" + install -Dm0644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" +} diff --git a/solitaire_app/Cargo.toml b/solitaire_app/Cargo.toml index 1e6039b..a442a4b 100644 --- a/solitaire_app/Cargo.toml +++ b/solitaire_app/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "solitaire_app" version.workspace = true +license.workspace = true edition.workspace = true [[bin]] diff --git a/solitaire_assetgen/Cargo.toml b/solitaire_assetgen/Cargo.toml index 69a06f9..1151841 100644 --- a/solitaire_assetgen/Cargo.toml +++ b/solitaire_assetgen/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "solitaire_assetgen" version.workspace = true +license.workspace = true edition.workspace = true publish = false diff --git a/solitaire_core/Cargo.toml b/solitaire_core/Cargo.toml index ee60e87..e59435c 100644 --- a/solitaire_core/Cargo.toml +++ b/solitaire_core/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "solitaire_core" version.workspace = true +license.workspace = true edition.workspace = true [dependencies] diff --git a/solitaire_data/Cargo.toml b/solitaire_data/Cargo.toml index 2c6b021..de1d173 100644 --- a/solitaire_data/Cargo.toml +++ b/solitaire_data/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "solitaire_data" version.workspace = true +license.workspace = true edition.workspace = true [dependencies] diff --git a/solitaire_engine/Cargo.toml b/solitaire_engine/Cargo.toml index 25c0eae..ea56ae5 100644 --- a/solitaire_engine/Cargo.toml +++ b/solitaire_engine/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "solitaire_engine" version.workspace = true +license.workspace = true edition.workspace = true [dependencies] diff --git a/solitaire_gpgs/Cargo.toml b/solitaire_gpgs/Cargo.toml index faaa158..55b8add 100644 --- a/solitaire_gpgs/Cargo.toml +++ b/solitaire_gpgs/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "solitaire_gpgs" version.workspace = true +license.workspace = true edition.workspace = true [dependencies] diff --git a/solitaire_server/Cargo.toml b/solitaire_server/Cargo.toml index f4e2eb6..3f99ceb 100644 --- a/solitaire_server/Cargo.toml +++ b/solitaire_server/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "solitaire_server" version.workspace = true +license.workspace = true edition.workspace = true [lib] diff --git a/solitaire_sync/Cargo.toml b/solitaire_sync/Cargo.toml index c2686cd..cf8f045 100644 --- a/solitaire_sync/Cargo.toml +++ b/solitaire_sync/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "solitaire_sync" version.workspace = true +license.workspace = true edition.workspace = true [dependencies]