Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add build script for linux #90

Merged
merged 5 commits into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ CMakeFiles/
Makefile
cmake_install.cmake
build
package-debian/out

#IDE
.idea/
*.iml

# Executables
mcmap
Expand Down
25 changes: 25 additions & 0 deletions package-debian/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
COMMIT_SHA_SHORT ?= $(shell git rev-parse --short=12 HEAD)
PWD_DIR:= ${CURDIR}
SHELL := /bin/bash

default: help;

# ======================================================================================
build-builder-debian: ## build the builder image that contains the source code
@docker build -f build-debian.dockerfile -t mcmap-builder-debian:latest ./..

build-debian: build-builder-debian ## build for linux using docker
@mkdir -p out
@docker run -it --rm -v ${PWD_DIR}/out:/out mcmap-builder-debian:latest /bin/bash -c "mkdir -p /mcmap/build && \
cd /mcmap/build && \
cmake .. && \
make -j mcmap mcmap-gui && \
cp /mcmap/build/bin/* /out"

package-debian: build-debian ## package the just compiled binary
@docker run -it --rm -v ${PWD_DIR}/out:/out mcmap-builder-debian:latest /bin/bash -c "cd /out && \
nfpm pkg -f /mcmap/package-debian/nfpm.yaml -p deb"


help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m- %-20s\033[0m %s\n", $$1, $$2}'
12 changes: 12 additions & 0 deletions package-debian/build-debian.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM ubuntu:22.10

ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/PDT
RUN apt-get update && apt-get install -y \
git make g++ libpng-dev cmake libspdlog-dev qttools5-dev

# install nfpm
RUN echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list && \
apt-get update && apt-get install -y nfpm

COPY . /mcmap
33 changes: 33 additions & 0 deletions package-debian/nfpm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# mcmap packaging config
# expects to be run from the `bin` directory

name: "mcmap"
arch: "amd64"
platform: "linux"
version: "3.0.2"
section: "default"
priority: "extra"
description: |
Mcmap is a tool allowing you to create isometric renders of your Minecraft save file.
maintainer: "Andres Bott <[email protected]>"
homepage: "https://github.com/spoutn1k/mcmap"
license: "GPL-3.0 license"
contents:
- src: ./mcmap # this path is mounted into the container
dst: /usr/local/bin/mcmap
file_info:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!
i didn't know this :D

mode: 0755
owner: root
group: root
- src: ./mcmap-gui
dst: /usr/local/bin/mcmap-gui
file_info:
mode: 0755
owner: root
group: root
overrides:
deb:
depends:
- libpng16-16
- libgomp1
- qtbase5-dev