Skip to content

Commit 41eb55f

Browse files
authored
Merge pull request #27 from M-Igashi/feature/linux-packages
feat: add Linux package support (AUR, Nix, Debian/Ubuntu)
2 parents 30fd388 + 7602492 commit 41eb55f

File tree

15 files changed

+504
-0
lines changed

15 files changed

+504
-0
lines changed

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,46 @@ jobs:
223223
git commit -m "Update mp3rgain to ${{ needs.release.outputs.version }}" || exit 0
224224
git push
225225
226+
# Build Debian package
227+
build-deb:
228+
name: Build Debian Package
229+
needs: release
230+
runs-on: ubuntu-latest
231+
continue-on-error: true
232+
steps:
233+
- uses: actions/checkout@v4
234+
235+
- name: Install dependencies
236+
run: |
237+
sudo apt-get update
238+
sudo apt-get install -y build-essential debhelper
239+
240+
- name: Install Rust
241+
uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable
242+
243+
- name: Setup debian directory
244+
run: cp -r packages/debian/debian .
245+
246+
- name: Update changelog version
247+
run: |
248+
VERSION=${{ needs.release.outputs.version }}
249+
DATE=$(date -R)
250+
cat > debian/changelog << EOF
251+
mp3rgain (${VERSION}-1) unstable; urgency=medium
252+
253+
* Release ${VERSION}
254+
255+
-- Masanari Higashi <M-Igashi@users.noreply.github.com> ${DATE}
256+
EOF
257+
258+
- name: Build package
259+
run: dpkg-buildpackage -us -uc -b
260+
261+
- name: Upload to release
262+
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2
263+
with:
264+
files: ../mp3rgain_${{ needs.release.outputs.version }}-1_amd64.deb
265+
226266
# Publish to crates.io
227267
publish-cargo:
228268
name: Publish to crates.io

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,35 @@ scoop install mp3rgain
7171
7272
### Linux
7373

74+
**Arch Linux (AUR)**:
75+
```bash
76+
# Using yay
77+
yay -S mp3rgain
78+
79+
# Using paru
80+
paru -S mp3rgain
81+
82+
# Manual
83+
git clone https://aur.archlinux.org/mp3rgain.git
84+
cd mp3rgain && makepkg -si
85+
```
86+
87+
**Nix/NixOS**:
88+
```bash
89+
# Using flakes
90+
nix run github:M-Igashi/mp3rgain
91+
92+
# Install to profile
93+
nix profile install github:M-Igashi/mp3rgain
94+
```
95+
96+
**Debian/Ubuntu (.deb)**:
97+
```bash
98+
# Download from releases
99+
wget https://github.com/M-Igashi/mp3rgain/releases/download/v1.1.1/mp3rgain_1.1.1-1_amd64.deb
100+
sudo dpkg -i mp3rgain_1.1.1-1_amd64.deb
101+
```
102+
74103
**Download binary:**
75104
1. Download `mp3rgain-*-linux-x86_64.tar.gz` from [GitHub Releases](https://github.com/M-Igashi/mp3rgain/releases)
76105
2. Extract: `tar -xzf mp3rgain-*-linux-x86_64.tar.gz`

packages/aur/.SRCINFO

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
pkgbase = mp3rgain
2+
pkgdesc = Lossless MP3 volume adjustment - a modern mp3gain replacement written in Rust
3+
pkgver = 1.1.1
4+
pkgrel = 1
5+
url = https://github.com/M-Igashi/mp3rgain
6+
arch = x86_64
7+
arch = aarch64
8+
license = MIT
9+
makedepends = rust
10+
makedepends = cargo
11+
depends = gcc-libs
12+
source = https://github.com/M-Igashi/mp3rgain/archive/v1.1.1.tar.gz
13+
sha256sums = SKIP
14+
15+
pkgname = mp3rgain

packages/aur/PKGBUILD

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Maintainer: Masanari Higashi <M-Igashi@users.noreply.github.com>
2+
pkgname=mp3rgain
3+
pkgver=1.1.1
4+
pkgrel=1
5+
pkgdesc='Lossless MP3 volume adjustment - a modern mp3gain replacement written in Rust'
6+
arch=('x86_64' 'aarch64')
7+
url='https://github.com/M-Igashi/mp3rgain'
8+
license=('MIT')
9+
depends=('gcc-libs')
10+
makedepends=('rust' 'cargo')
11+
source=("https://github.com/M-Igashi/mp3rgain/archive/v${pkgver}.tar.gz")
12+
sha256sums=('SKIP')
13+
14+
build() {
15+
cd "mp3rgain-${pkgver}"
16+
export CARGO_HOME="${srcdir}/cargo-home"
17+
cargo build --release --locked
18+
}
19+
20+
check() {
21+
cd "mp3rgain-${pkgver}"
22+
export CARGO_HOME="${srcdir}/cargo-home"
23+
cargo test --release --locked
24+
}
25+
26+
package() {
27+
cd "mp3rgain-${pkgver}"
28+
install -Dm755 target/release/mp3rgain "${pkgdir}/usr/bin/mp3rgain"
29+
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/mp3rgain/LICENSE"
30+
install -Dm644 README.md "${pkgdir}/usr/share/doc/mp3rgain/README.md"
31+
}

packages/aur/README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# mp3rgain AUR Package
2+
3+
This directory contains the PKGBUILD for the Arch Linux User Repository (AUR).
4+
5+
## Installation (for users)
6+
7+
```bash
8+
# Using yay
9+
yay -S mp3rgain
10+
11+
# Using paru
12+
paru -S mp3rgain
13+
14+
# Manual installation
15+
git clone https://aur.archlinux.org/mp3rgain.git
16+
cd mp3rgain
17+
makepkg -si
18+
```
19+
20+
## Publishing to AUR (for maintainers)
21+
22+
1. Clone the AUR repository:
23+
```bash
24+
git clone ssh://aur@aur.archlinux.org/mp3rgain.git aur-mp3rgain
25+
cd aur-mp3rgain
26+
```
27+
28+
2. Copy the PKGBUILD and .SRCINFO:
29+
```bash
30+
cp /path/to/mp3rgain/packages/aur/PKGBUILD .
31+
cp /path/to/mp3rgain/packages/aur/.SRCINFO .
32+
```
33+
34+
3. Update the sha256sum in PKGBUILD:
35+
```bash
36+
updpkgsums
37+
```
38+
39+
4. Regenerate .SRCINFO:
40+
```bash
41+
makepkg --printsrcinfo > .SRCINFO
42+
```
43+
44+
5. Test the build:
45+
```bash
46+
makepkg -si
47+
```
48+
49+
6. Commit and push:
50+
```bash
51+
git add PKGBUILD .SRCINFO
52+
git commit -m "Update to version X.Y.Z"
53+
git push
54+
```
55+
56+
## Version Updates
57+
58+
When releasing a new version:
59+
60+
1. Update `pkgver` in PKGBUILD
61+
2. Reset `pkgrel` to 1
62+
3. Update sha256sum with `updpkgsums`
63+
4. Regenerate .SRCINFO
64+
5. Test build locally
65+
6. Push to AUR

packages/debian/README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# mp3rgain Debian Package
2+
3+
This directory contains the Debian packaging files for building `.deb` packages.
4+
5+
## Building the Package
6+
7+
### Prerequisites
8+
9+
```bash
10+
# Install build dependencies
11+
sudo apt-get update
12+
sudo apt-get install -y build-essential debhelper cargo rustc
13+
```
14+
15+
### Build Steps
16+
17+
1. Clone the repository and navigate to the project root:
18+
```bash
19+
git clone https://github.com/M-Igashi/mp3rgain.git
20+
cd mp3rgain
21+
```
22+
23+
2. Copy the debian directory to the project root:
24+
```bash
25+
cp -r packages/debian/debian .
26+
```
27+
28+
3. Build the package:
29+
```bash
30+
dpkg-buildpackage -us -uc -b
31+
```
32+
33+
4. The `.deb` file will be created in the parent directory:
34+
```bash
35+
ls ../*.deb
36+
```
37+
38+
### Installing the Package
39+
40+
```bash
41+
sudo dpkg -i ../mp3rgain_1.1.1-1_amd64.deb
42+
```
43+
44+
### Using Docker (recommended for clean builds)
45+
46+
```bash
47+
# Build using Docker
48+
docker run --rm -v "$(pwd):/src" -w /src debian:bookworm bash -c '
49+
apt-get update && \
50+
apt-get install -y build-essential debhelper cargo rustc && \
51+
cp -r packages/debian/debian . && \
52+
dpkg-buildpackage -us -uc -b
53+
'
54+
```
55+
56+
## GitHub Actions Build
57+
58+
The `.deb` package is automatically built on each release. Download the artifact from the GitHub Actions workflow or the release assets.
59+
60+
## Version Updates
61+
62+
When releasing a new version:
63+
64+
1. Update `packages/debian/debian/changelog`:
65+
```bash
66+
dch -v NEW_VERSION-1 "Release NEW_VERSION"
67+
```
68+
69+
2. Update the version in `Cargo.toml`
70+
71+
3. Rebuild the package
72+
73+
## File Descriptions
74+
75+
- `control`: Package metadata and dependencies
76+
- `rules`: Build instructions (Makefile)
77+
- `changelog`: Version history
78+
- `copyright`: License information
79+
- `compat`: Debhelper compatibility level
80+
- `source/format`: Source package format

packages/debian/debian/changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
mp3rgain (1.1.1-1) unstable; urgency=medium
2+
3+
* Initial release.
4+
5+
-- Masanari Higashi <M-Igashi@users.noreply.github.com> Mon, 13 Jan 2025 00:00:00 +0000

packages/debian/debian/compat

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

packages/debian/debian/control

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Source: mp3rgain
2+
Section: sound
3+
Priority: optional
4+
Maintainer: Masanari Higashi <M-Igashi@users.noreply.github.com>
5+
Build-Depends: debhelper-compat (= 13), cargo, rustc
6+
Standards-Version: 4.6.0
7+
Homepage: https://github.com/M-Igashi/mp3rgain
8+
Vcs-Browser: https://github.com/M-Igashi/mp3rgain
9+
Vcs-Git: https://github.com/M-Igashi/mp3rgain.git
10+
Rules-Requires-Root: no
11+
12+
Package: mp3rgain
13+
Architecture: any
14+
Depends: ${shlibs:Depends}, ${misc:Depends}
15+
Description: Lossless MP3 volume adjustment tool
16+
mp3rgain is a modern mp3gain replacement written in Rust that adjusts
17+
MP3 file volumes losslessly using ReplayGain analysis. It modifies only
18+
the MP3 header information without re-encoding the audio data.
19+
.
20+
Features:
21+
- ReplayGain 2.0 analysis and tagging
22+
- Album and track gain modes
23+
- Batch processing with progress display
24+
- JSON output for scripting
25+
- Cross-platform support

packages/debian/debian/copyright

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Upstream-Name: mp3rgain
3+
Upstream-Contact: Masanari Higashi <M-Igashi@users.noreply.github.com>
4+
Source: https://github.com/M-Igashi/mp3rgain
5+
6+
Files: *
7+
Copyright: 2024-2025 Masanari Higashi
8+
License: MIT
9+
10+
License: MIT
11+
Permission is hereby granted, free of charge, to any person obtaining a copy
12+
of this software and associated documentation files (the "Software"), to deal
13+
in the Software without restriction, including without limitation the rights
14+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15+
copies of the Software, and to permit persons to whom the Software is
16+
furnished to do so, subject to the following conditions:
17+
.
18+
The above copyright notice and this permission notice shall be included in all
19+
copies or substantial portions of the Software.
20+
.
21+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27+
SOFTWARE.

0 commit comments

Comments
 (0)