Enhancement: Makefile replaces sh scripts

Also changed travis ci config
This commit is contained in:
Floréal Toumikian 2020-08-28 17:49:49 +02:00
parent 286912dbf2
commit 35f5327b08
5 changed files with 72 additions and 49 deletions

View File

@ -1,22 +1,21 @@
language: node_js
language: rust
node_js:
- lts/*
rust:
- stable
- beta
- nightly
sudo: required
services:
- docker
jobs:
allow_failures:
- rust: nightly
fast_finish: true
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libstdc++-5-dev
cache: cargo
install:
- npm i -g @elementaryos/houston
before_script:
- sudo apt-get install libgtk-3-dev
script:
- houston ci
- cargo test --verbose --workspace

59
Makefile Normal file
View File

@ -0,0 +1,59 @@
TARGET ?= target/release/mobydick
PREFIX ?= /usr/local
CARGO ?= cargo
UNINSTALL_FILES = $(PREFIX)/bin/xyz.gelez.mobydick \
$(PREFIX)/share/appdata/xyz.gelez.mobydick.appdata.xml \
$(PREFIX)/share/applications/mobydick.desktop \
$(PREFIX)/share/icons/hicolor/128x128/apps/mobydick.svg \
$(PREFIX)/share/icons/hicolor/16x16/apps/mobydick.svg \
$(PREFIX)/share/icons/hicolor/24x24/apps/mobydick.svg \
$(PREFIX)/share/icons/hicolor/32x32/apps/mobydick.svg \
$(PREFIX)/share/icons/hicolor/48x48/apps/mobydick.svg \
$(PREFIX)/share/icons/hicolor/64x64/apps/mobydick.svg
.phony: all
all: $(TARGET)
$(TARGET):
$(CARGO) build --release
.phony: check
chuck:
$(CARGO) check && $(CARGO) test
.phony: install
install: install-exe install-data
.phony: install-exe
install-exe:
install -d $(PREFIX)/bin/ && \
install target/release/mobydick $(PREFIX)/bin/xyz.gelez.mobydick
.phony: install-data
install-data: install-app-data install-app-desktop install-icons
.phony: install-app-data
install-app-data:
install -d $(PREFIX)/share/appdata && \
install -m -x -t $(PREFIX)/share/appdata xyz.gelez.mobydick.appdata.xml
.phony: install-app-desktop
install-app-desktop:
install -d $(PREFIX)/share/applications && \
install -m -x -t $(PREFIX)/share/applications mobydick.desktop
.phony: install-icons
install-icons:
for s in "16" "24" "32" "48" "64" "128"; do \
install -d $(PREFIX)/share/icons/hicolor/$${s}x$${s}/apps/ && \
install -m -x icons/$$s.svg $(PREFIX)/share/icons/hicolor/$${s}x$${s}/apps/mobydick.svg ;\
done
.phony: uninstall
uninstall:
$(RM) -f $(UNINSTALL_FILES)
.phony: clean
clean:
$(CARGO) clean

View File

@ -1,3 +0,0 @@
#!/usr/bin/env bash
cargo build --release

View File

@ -1,19 +0,0 @@
#!/usr/bin/env sh
if [ -z "$PREFIX" ]; then
PREFIX=/usr/local
fi
if [ ! -f target/release/mobydick ]; then
./build.sh
fi
sudo install -v -d $PREFIX/bin/
sudo install -v target/release/mobydick $PREFIX/bin/xyz.gelez.mobydick
sudo install -v -d $PREFIX/share/appdata
sudo install -v -t $PREFIX/share/appdata *.appdata.xml
sudo install -v -d $PREFIX/share/applications
sudo install -v -t $PREFIX/share/applications *.desktop
for s in "16" "24" "32" "48" "64" "128"; do
sudo install -v -d $PREFIX/share/icons/hicolor/${s}x${s}/
sudo install -v icons/$s.svg $PREFIX/share/icons/hicolor/${s}x${s}/mobydick.svg
done

View File

@ -1,13 +0,0 @@
#!/usr/bin/env bash
if [ -z "$PREFIX" ]; then
PREFIX=/usr/local
fi
sudo rm -v $PREFIX/bin/xyz.gelez.mobydick
sudo rm -v $PREFIX/share/appdata/$(ls *.appdata.xml)
sudo rm -v $PREFIX/share/applications/$(ls *.desktop)
for s in "16" "24" "32" "48" "64" "128"; do
sudo rm -v $PREFIX/share/icons/hicolor/${s}x${s}/mobydick.svg
done