Skip to content

Repository files navigation

MineSweeper

Build GitHub release

MineSweeper is a simple Minesweeper clone implemented in C using GTK4.
It provides a classic Minesweeper experience with a modern GTK4 interface, and is designed to run on Linux systems.


Table of Contents


Installation

Ubuntu/Debian

Ubuntu 23.0 / Debian 13 or newer

You can install the latest version of MineSweeper by running the following command in your terminal

    curl -sL https://pstasiak2000.github.io/MineSweeper/scripts/install_deb.sh | bash

Ubuntu 22.0 / Debian 12 or older

For older versions of Ubuntu, you will need to build the .deb package first. The script is provided in /scripts/build-deb.sh.

Firstly make sure the relevant dependencies are installed:

  sudo apt update
  sudo apt install libgtk-4-dev librsvg2-dev devscripts debhelper dh-cmake 

Now from repo root, run the build script

./scripts/build-deb.sh

This will create a minesweeper_X.Y.Z-1_amd64.deb in the parent directory. You can now install the application with

  sudo apt install ./minesweeper*.deb

Arch Linux

On Arch Linux and derivatives, you can build and install using the provided PKGBUILD:

# Clone the repository
git clone https://github.com/pstasiak2000/MineSweeper.git
cd MineSweeper

# Copy the Arch PKGBUILD to the root
cp packaging/arch/PKGBUILD .

# Build and install the package
makepkg -si

Warning

Note: The PKGBUILD assumes the repository layout is unchanged. Moving files or directories may cause build failures.

After installation, MineSweeper will be available as a standard application and should appear in your desktop environment’s application menu.

Compiling from source

If you prefer to build directly from source, follow these steps:

1. Configure the project with CMake

# Clean previous builds
rm -rf build

# Configure the build directory
cmake -B build -S . -DCMAKE_INSTALL_PREFIX=/usr

If you wish to compile the source code with developer tools included, you can enable them by setting -DCOMPILE_WITH_DEV_TOOLS=TRUE during the configuration.

2. Build the project

cmake --build build

This will compile all source files and generate the MineSweeper executable in the build directory.

3. Install the project

  • To install to the default systems directories:
sudo cmake --install build
  • To install to a custom directory (useful for staging or packaging):
DESTDIR=/path/to/install cmake --install build

Post-install notes

  • The application installs a .desktop file, so it should integrate with most Linux desktop environments automatically.
  • Icons are installed in standard locations (/usr/share/icons/hicolor/...) and should appear in menus and window decorations.
  • If you’re running KDE, you may need to refresh the application cache:
kbuildsycoca5
  • To uninstall:

    • If installed via PKGBUILD:
        sudo pacman -R minesweeper
    • If installed manually: remove the installed files in /usr/bin, /usr/share/applications/, /usr/share/icons/, and /usr/share/metainfo/.

Dependencies

  • GTK4
  • librsvg
  • glib2 (for building)
  • cmake (for building)
  • pkgconf (for building)

Troubleshooting

  • CMAKE cannot find CMakeLists.txt: Make sure you run cmake -S . from the repository root, not from src/ or any other subdirectory.

  • Resources errors ( resources.c, .gresource.xml, .png / .svg missing): Ensure that resources.c is generated or included in src/ and that the paths in resources.gresource.xml are correct relative to the repository root.

  • PKGBUILD build errors with local sources: Use source=("file://../") if the PKGBUILD is in a subdirectory, pointing to the repository root.

This ensures $srcdir resolves correctly.

  • Application icon not showing in KDE: Refresh the application cache:
kbuildsycoca5
  • General build errors: Make sure all dependencies (gtk4, librsvg,glib2,cmake,pkgconf) are installed.

Clean your build directory if necessary:

rm -rf build

About

Source code for mine sweeper built in C

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages