Guide: Compile snes9x-gtk from Source & Create .deb Package (Ubuntu/Debian)

This is for people involved in the developement of Snes9x, or SNES emulators in general.
BUG REPORTS BELONG IN TECH SUPPORT/BUG TRACKING!
Post Reply
monway
Snes9x White Belt
Posts: 2
Joined: Wed May 27, 2020 3:12 am
Location: The Hole

Guide: Compile snes9x-gtk from Source & Create .deb Package (Ubuntu/Debian)

Post by monway »

This post is meant with the utmost respect to the developers of Snes9x. All credit and rights go to the Snes9x team. I take no ownership of this software , I'm simply a user who successfully built and packaged it for native Ubuntu use.

I'm not a developer or expert. I used ChatGPT to guide me through this process, and it worked extremely well. My goal is to help others enjoy a native `.deb` install of Snes9x-GTK on Debian-based systems (Ubuntu, Mint, etc.), complete with icons, launcher, and system integration — all without relying on Snap or Flatpak.

Feel free to correct or improve this process. I encourage community input and respectfully defer to the developers on whether this could evolve into an official `.deb` release.

---

? What This Guide Does
- Compiles the latest GTK build of snes9x from source (v1.63)
- Installs cleanly to `/usr`
- Integrates into the desktop environment (icons, launcher)
- Packages as a `.deb` using `dpkg-deb`
- Allows for clean uninstall with `dpkg -r`

---

🛠 Prerequisites

Code: Select all

sudo apt update && sudo apt install   git cmake ninja-build build-essential   libgtk-3-dev libpulse-dev libasound2-dev   libao-dev libxv-dev libxi-dev libpng-dev   libzstd-dev checkinstall
---

📥 Clone the Repo w/ Submodules

Code: Select all

git clone --recurse-submodules https://github.com/snes9xgit/snes9x.git
cd snes9x/gtk
If you already cloned it but forgot `--recurse-submodules`:

Code: Select all

git submodule update --init --recursive
---

?? Configure the Build

Code: Select all

cmake -G Ninja   -DCMAKE_INSTALL_PREFIX=/usr   -DCMAKE_BUILD_TYPE=Release   -S . -B build
---

🔨 Build It

Code: Select all

cd build
ninja
---

📦 Stage Install to Package Directory

Code: Select all

DESTDIR=~/snes9x-pkgroot ninja install
---

🧰 Create .deb Package Manually

Make the directory layout:

Code: Select all

mkdir -p ~/snes9x-deb/DEBIAN
mkdir -p ~/snes9x-deb/usr
cp -r ~/snes9x-pkgroot/usr ~/snes9x-deb/
Create the `control` file:

Code: Select all

cat > ~/snes9x-deb/DEBIAN/control <<EOF
Package: snes9x-gtk
Version: 1.63
Section: games
Priority: optional
Architecture: amd64
Maintainer: (Unofficial) Community Build
Description: GTK frontend for SNES9X emulator — clean native build with full desktop integration.
EOF
Build the package:

Code: Select all

dpkg-deb --build ~/snes9x-deb ~/Desktop/snes9x-gtk_1.63-1_amd64.deb
---

📥 Install the .deb

Code: Select all

sudo dpkg -i ~/Desktop/snes9x-gtk_1.63-1_amd64.deb
If dependencies are missing:

Code: Select all

sudo apt --fix-broken install
---

🧪 Confirmed Working
- Verified on Ubuntu MATE (custom build)
- Icons all appear (16x16 to 256x256)
- Menu launcher works
- Emulator launches fast and clean
- Runs games smoothly

---

🧼 Optional Uninstall

Code: Select all

sudo dpkg -r snes9x-gtk
Again, I give full credit to the Snes9x team. I share this only to help others enjoy the software on native Debian-based systems. This method uses no Snap/Flatpak, just traditional Linux packaging and source building.

Thanks to the devs for making one of the best emulators of all time. 🙏

– Monway
Post Reply