Skip to content
This repository has been archived by the owner on Mar 20, 2022. It is now read-only.

Commit

Permalink
Vala rewrite (v0.13.0).
Browse files Browse the repository at this point in the history
  • Loading branch information
torralbaalla committed Aug 14, 2021
1 parent 482d6a8 commit ca2a299
Show file tree
Hide file tree
Showing 32 changed files with 877 additions and 1,432 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build all

on:
push:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: docker-practice/actions-setup-docker@master
- name: Setup Docker Multiarch
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Build ARM
run: |
docker pull arm32v7/buildpack-deps:buster
docker run -v $PWD:$PWD -w $PWD --rm arm32v7/buildpack-deps:buster bash ./ci.sh
- name: Build AArch64
run: |
docker pull arm64v8/buildpack-deps:buster
docker run -v $PWD:$PWD -w $PWD --rm arm64v8/buildpack-deps:buster bash ./ci.sh
- name: Build x86_64
run: |
docker pull amd64/buildpack-deps:buster
docker run -v $PWD:$PWD -w $PWD --rm amd64/buildpack-deps:buster bash ./ci.sh
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: gmcpil_debs
path: gmcpil_*.deb
22 changes: 0 additions & 22 deletions .github/workflows/build_amd64.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Builds
build/
*.c
*.o

# Debian
*.deb
Expand Down
111 changes: 34 additions & 77 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,104 +1,61 @@
#
# Makefile
#
# Copyright 2021 Alvarito050506 <donfrutosgomez@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
#
VERSION:=0.13.0
SRCS:=$(patsubst %,./src/%.vala,profile config gui play features servers)
SRCS+=./src/gmcpil.vapi

ifdef USE_CLANG
ifeq ($(origin CC),default)
CC:=clang
endif
STRIP?=llvm-strip
LDFLAGS:=-fuse-ld=lld
ARCH:=$(shell $(CC) -dumpmachine | grep -Eo "arm|aarch|86|x86_64")
else
ifeq ($(origin CC),default)
CC:=gcc
endif
STRIP?=strip
LDFLAGS:=
ARCH:=$(shell $(CC) -print-multiarch | grep -Eo "arm|aarch|86|x86_64")
PKG_CONFIG?=pkg-config
ifdef CROSS_COMPILE
CC:=$(CROSS_COMPILE)-gcc
PKG_CONFIG:=$(CROSS_COMPILE)-pkg-config
STRIP:=$(CROSS_COMPILE)-strip
endif

VERSION:=0.12.0

OBJS:=$(patsubst %,build/%.o,mcpil config features play servers)
VFLAGS:=--pkg json-glib-1.0 --pkg gio-2.0 --pkg gtk+-3.0
VFLAGS+=--cc=$(CC) --pkg-config=$(PKG_CONFIG) -X -DGMCPIL_VERSION="\"v$(VERSION)\""

CFLAGS+=-DGMCPIL_VERSION=\"v$(VERSION)\" -I./src/include -Wall -Wno-address-of-packed-member -Wno-pointer-to-int-cast -Wno-unused-result
CFLAGS+=$(shell pkg-config --cflags gtk+-3.0 json-glib-1.0)
LDFLAGS+=-Wl,--no-undefined $(shell pkg-config --libs gtk+-3.0 json-glib-1.0)
ARCH:=$(shell $(CC) -dumpmachine | grep -Eo "arm|aarch|86|x86_64")
ifeq ($(ARCH),86)
DEB_ARCH:=i386
else ifeq ($(ARCH),x86_64)
DEB_ARCH:=amd64
else ifeq ($(ARCH),aarch)
DEB_ARCH:=arm64
else
DEB_ARCH:=armhf
endif

ifdef DEBUG
CFLAGS+=-g -Wextra -Werror
VFLAGS+=-X -g --save-temps --fatal-warnings
else
CFLAGS+=-O3
VFLAGS+=-X -O3
endif

# Some GTK+/GDK-Pixbuf combinations may generate this warning
# for internal functions, so let's "ignore" it.
CFLAGS+=-Wno-error=deprecated-declarations

.PHONY: ./build/gmcpil
ifndef NO_BUSTER_COMPAT
VFLAGS+=-D BUSTER_COMPAT
endif

./build/gmcpil: mkdir $(OBJS)
$(CC) -fPIC -fpie $(OBJS) -o $@ $(CFLAGS) $(LDFLAGS)
./build/gmcpil: ./build/ $(SRCS)
valac $(VFLAGS) $(SRCS) -o ./build/gmcpil
ifndef DEBUG
$(STRIP) ./build/gmcpil
endif

./build/%.o: ./src/%.c ./src/include/*.h
$(CC) -fPIC -fpie -c $< -o $@ $(CFLAGS)

mkdir:
./build/:
mkdir -p ./build/

pack: ./build/gmcpil
mkdir -p ./deb/DEBIAN/
mkdir -p ./deb/usr/bin/
mkdir -p ./deb/usr/share/
cp ./build/gmcpil ./deb/usr/bin/
cp -r ./res/. ./deb/usr/share/
cp -r ./res/usr/share/ ./deb/usr/
chmod a+x ./deb/usr/bin/gmcpil
@echo "Package: gmcpil" > ./deb/DEBIAN/control
@echo "Version: $(VERSION)" >> ./deb/DEBIAN/control
@echo "Priority: optional" >> ./deb/DEBIAN/control
ifeq ($(ARCH),86)
@echo "Architecture: i386" >> ./deb/DEBIAN/control
else ifeq ($(ARCH),x86_64)
@echo "Architecture: amd64" >> ./deb/DEBIAN/control
else ifeq ($(ARCH),aarch)
@echo "Architecture: arm64" >> ./deb/DEBIAN/control
else
@echo "Architecture: armhf" >> ./deb/DEBIAN/control
endif
@echo "Section: contrib/misc" >> ./deb/DEBIAN/control
@echo "Depends: libc6 (>= 2.28), minecraft-pi-reborn-client (>= 2.1.0), libgtk-3-0, libjson-glib-1.0-0" >> ./deb/DEBIAN/control
@echo "Maintainer: Alvarito050506 <donfrutosgomez@gmail.com>" >> ./deb/DEBIAN/control
@echo "Homepage: https://mcpirevival.tk" >> ./deb/DEBIAN/control
@echo "Vcs-Browser: https://github.com/MCPI-Revival/gMCPIL" >> ./deb/DEBIAN/control
@echo "Vcs-Git: https://github.com/MCPI-Revival/gMCPIL.git" >> ./deb/DEBIAN/control
@echo "Description: Simple launcher for Minecraft: Pi Edition - GTK+ Edition." >> ./deb/DEBIAN/control
@echo " Simple GUI launcher for Minecraft: Pi Edition and MCPI-Reborn," >> ./deb/DEBIAN/control
@echo " rewritten in C using GTK+ 3." >> ./deb/DEBIAN/control
fakeroot dpkg-deb -b ./deb/ ./gmcpil_$(VERSION).deb
sed "s/{{ARCH}}/$(DEB_ARCH)/g; s/{{VERSION}}/$(VERSION)/g" ./res/control > ./deb/DEBIAN/control
fakeroot dpkg-deb -b ./deb/ ./gmcpil_$(VERSION)_$(DEB_ARCH).deb

clean:
rm -rf ./deb/
rm -rf ./src/*.c
rm -rf ./build/

purge: clean
rm -f ./gmcpil_*.deb
30 changes: 8 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<h1 align="center">gMCPIL</h1>
<p align="center">
Simple launcher for Minecraft: Pi Edition and <a href="https://gitea.thebrokenrail.com/TheBrokenRail/minecraft-pi-reborn/">MCPI-Reborn</a> - GTK+ Edition.
Simple launcher for Minecraft: Pi Edition and <a href="https://gitea.thebrokenrail.com/TheBrokenRail/minecraft-pi-reborn/">MCPI-Reborn</a> - Vala/GTK+ Edition.
</p>
<p align="center">
<a href="https://github.com/MCPI-Revival/gMCPIL/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/MCPI-Devs/MCPIL?label=License" alt="GPL-2.0"></img>
<img src="https://img.shields.io/github/license/MCPI-Revival/gMCPIL?label=License" alt="GPL-2.0"></img>
</a>
<a href="https://github.com/MCPI-Revival/gMCPIL/releases/latest">
<img src="https://img.shields.io/github/v/release/MCPI-Revival/gMCPIL" alt="Latest release"></img>
</a>
</p>


<p align="center">
<img src="https://raw.githubusercontent.com/MCPI-Revival/gMCPIL/master/screenshot.png" alt="screenshot"></img>
</p>
Expand All @@ -34,36 +33,23 @@ sudo apt install gmcpil
You can also download and install it from the [releases](https://github.com/MCPI-Revival/gMCPIL/releases) section.

### Compiling
To build gMCPIL, you'll need GCC or Clang for the native and `arm-linux-gnueabihf` targets, plus some additional packages.
Assuming a Debian-based distro, you can install them with the following command:
```sh
# For GCC
sudo apt install gcc build-essential gcc-arm-linux-gnueabihf crossbuild-essential-armhf

# Libraries and other build dependencies
sudo apt install git make libjson-glib-dev libgtk-3-dev dpkg-dev fakeroot
```
To build gMCPIL, you'll need Vala, a C compiler, and some additional packages.
Assuming a Debian-based distro, you can install them running the commands listed
[here](https://github.com/MCPI-Revival/gMCPIL/blob/master/ci.sh#L7-L13) as root.

After installing the build dependencies, you can clone the repo and build gMCPIL:
```sh
git clone https://github.com/MCPI-Revival/gMCPIL
cd gMCPIL

make # Build gMCPIL and mods
make # Build gMCPIL
make pack # Make a Debian package
```

You can also set the `DEBUG` and `USE_CLANG` environment variables to add debug symbols to the executable
and build using Clang instead of GCC, respectively.

## Features
+ Full MCPI-Reborn integration
+ Proxy-free multiplayer
+ Featured servers
+ Coming soon: More stuff
You can also set the `DEBUG` environment variable to add debug symbols to the executable.

## Changelog
See the [CHANGELOG.txt](https://github.com/MCPI-Revival/gMCPIL/blob/master/res/doc/gmcpil/CHANGELOG.txt) file.
See the [CHANGELOG.txt](https://github.com/MCPI-Revival/gMCPIL/blob/master/res/usr/share/doc/gmcpil/CHANGELOG.txt) file.

## Licensing
All the code of this project is licensed under the [GNU General Public License version 2.0](https://github.com/Alvarito050506/MCPIL/blob/master/LICENSE) (GPL-2.0).
Expand Down
16 changes: 16 additions & 0 deletions ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e

export DEBIAN_FRONTEND="noninteractive"

echo "deb [trusted=yes] https://deb.debian.org/debian buster-backports main contrib non-free" >> /etc/apt/sources.list

apt update
apt upgrade -y
apt install -y git make fakeroot dpkg-dev build-essential libgtk-3-dev libjson-glib-dev
apt install -y -t buster-backports valac
apt --fix-broken install

make pack
make clean
13 changes: 13 additions & 0 deletions res/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Package: gmcpil
Version: {{VERSION}}
Priority: optional
Architecture: {{ARCH}}
Section: contrib/misc
Depends: libc6 (>= 2.28), minecraft-pi-reborn-client (>= 2.1.0), libgtk-3-0, libjson-glib-1.0-0
Maintainer: Alvarito050506 <donfrutosgomez@gmail.com>
Homepage: https://mcpirevival.tk
Vcs-Browser: https://github.com/MCPI-Revival/gMCPIL
Vcs-Git: https://github.com/MCPI-Revival/gMCPIL.git
Description: Simple launcher for Minecraft: Pi Edition - GTK+ Edition.
Simple GUI launcher for Minecraft: Pi Edition and MCPI-Reborn,
rewritten in Vala using GTK+ 3.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v0.13.0:
+ Rewritten in Vala.
+ More refactoring.
+ Fixed various bugs.

v0.12.0:
+ New, fancy GUI.
+ Lots of "refactoring".
Expand Down
File renamed without changes.
Binary file modified screenshot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ca2a299

Please sign in to comment.