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

Updated GNU/Linux Build Instructions #207

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"depcheck": "dependency-check app --entry main.js --unused --no-dev",
"lint": "standard",
"start": "electron ./app/main",
"clean:linux": "rimraf releases/linux* release/*.deb release/*.AppImage",
"clean:linux": "rimraf releases/linux* release/*.deb release/*.rpm release/*.AppImage",
"clean:osx": "rimraf releases/mac",
"clean:win": "rimraf releases/win*",
"clean": "npm run clean:linux && npm run clean:win && npm run clean:osx",
Expand All @@ -51,8 +51,7 @@
"build:win": "npm run build:win32 && npm run build:win64",
"build:win64": "npm run prebuild && electron-builder --win --x64 && npm run postbuild",
"build:win32": "npm run prebuild && electron-builder --win --ia32 && npm run postbuild && npm run win32copy",
"build:linux:x64": "npm run prebuild && electron-builder --linux deb AppImage --x64 && npm run postbuild",
"build:linux:deb": "./scripts/build_linux_deb.sh",
"build:linux:x64": "npm run prebuild && electron-builder --linux deb rpm AppImage --x64 && npm run postbuild",
"win32copy": " mv ./releases/MZD-AIO-TI_Setup_2.8.6.exe ./releases/MZD-AIO-TI_Setup_2.8.6_Win32.exe && mv ./releases/MZD-AIO-TI_Setup_2.8.6.exe.blockmap ./releases/MZD-AIO-TI_Setup_2.8.6_Win32.exe.blockmap",
"build": "electron-builder",
"release": "electron-builder",
Expand Down
28 changes: 21 additions & 7 deletions scripts/Dockerfile.linux
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
FROM node:boron
MAINTAINER Misha Nasledov <[email protected]>
# Image Maintainers
LABEL maintainer="Misha Nasledov <[email protected]>, Rohan Barar <[email protected]>"

RUN apt-get update \
&& apt-get -y install graphicsmagick icnsutils \
&& apt-get clean
# Node.js Version 13 Base Image
FROM node:13

# Update sources list for apt package manager (base image contains outdated URLs)
RUN sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list
RUN sed -i s/security.debian.org/archive.debian.org/g /etc/apt/sources.list
RUN sed -i s/stretch-updates/stretch/g /etc/apt/sources.list

# Update and install required packages
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get -y install graphicsmagick icnsutils rpm
RUN apt-get clean

# Copy the contents of the current directory into the '/work' directory inside the container
ADD . /work

RUN cd /work \
&& npm install
# Set the working directory to '/work'
WORKDIR /work

# Install node.js packages and dependencies listed within 'package.json'
RUN npm install
109 changes: 93 additions & 16 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,100 @@
build_linux_deb.sh
==================
This script will create a `docker` (http://www.docker.com/) container with all the dependencies to build `MZD-AIO-TI` and build it inside the container. On success, it will spit out the DEB in your current working directory.
# Build `MZD AIO Tweaks` for GNU/Linux
The following instructions utilise a [`podman`](https://podman.io/) container to build `MZD-AIO-TI`.

Usage:
$ `./scripts/build_linux_deb.sh`
Compiling applications within containers is beneficial because it:
- Prevents conflicts with newer versions of dependencies.
- Lowers the risk of compilation errors caused by idiosyncrasies between systems.
- Avoids cluttering the system with packages installed solely for the purpose of compiling the software.

The `build_linux_deb_helper.sh` script is written to be run in the Docker container, so please don't invoke it directly.
Note: The `build_linux.sh` script is written to be run in the `podman` container, so please do not invoke it directly.

This way of building stuff inside ephemeral containers is useful as it avoids people needing the correct dependencies on their own systems if they simply want to build it. It's particularly useful to get builds going on some sort of Continuous Integration solution such as Jenkins or Travis (TBD).
## Instructions
1. Ensure the dockerfile at `/MZD-AIO/scripts/Dockerfile.linux` contains the following:
```dockerfile
# Image Maintainers
LABEL maintainer="Misha Nasledov <[email protected]>, Rohan Barar <[email protected]>"

## Build DEB file
# Node.js Version 13 Base Image
FROM node:13

```bash
npm run-script build:linux:deb
```
# Update sources list for apt package manager (base image contains outdated URLs)
RUN sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list
RUN sed -i s/security.debian.org/archive.debian.org/g /etc/apt/sources.list
RUN sed -i s/stretch-updates/stretch/g /etc/apt/sources.list

## Install
# Update and install required packages
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get -y install graphicsmagick icnsutils rpm
RUN apt-get clean

```bash
sudo apt install libappindicator1 libindicator7
sudo dpkg -i MZD-AIO-TI-linux_2.7.0.deb
```
# Copy the contents of the current directory into the '/work' directory inside the container
ADD . /work

# Set the working directory to '/work'
WORKDIR /work

# Install node.js packages and dependencies listed within 'package.json'
RUN npm install
```

2. Ensure the bash script at `/MZD-AIO/scripts/build_linux.sh` contains the following:
```bash
#!/usr/bin/env bash
set -xue

# Save the current working directory to the stack and change the working directory to '/work'
pushd /work

# Build '.deb', '.rpm' and '.AppImage' files
npm run-script build:linux:x64

# Move compiled packages to the output folder
mv releases/*.{deb,rpm,AppImage} /output
```

3. Mark the bash script at `/MZD-AIO/scripts/build_linux.sh` as executable.
```bash
chmod +x /path/to/MZD-AIO/scripts/build_linux.sh
```

4. Ensure you are within the root directory of the cloned repository.
```bash
cd /path/to/MZD-AIO
```

5. Build the image. Ignore the deprecation warnings.
```bash
podman build -t build-mzd-aio-lnx -f ./scripts/Dockerfile.linux .
```

6. Check your new image 'localhost/build-mzd-aio-lnx' is listed.
```bash
podman images
```

7. Create and run a container based on the 'build-mzd-aio-lnx' image.
```bash
podman run -v ${PWD}:/output -t build-mzd-aio-lnx /work/scripts/build_linux.sh
```

_Note: If you are on a system with SELinux enabled (e.g. Fedora), you might need to add the ':z' option to the volume mount to allow `podman` to relabel the content for access by the container._
```bash
podman run -v ${PWD}:/output:z -t build-mzd-aio-lnx /work/scripts/build_linux.sh
```

8. Install the resulting `.deb` or `.rpm` file.
- Debian-based GNU/Linux distributions:
```bash
sudo apt install libappindicator1 libindicator7
sudo dpkg -i MZD-AIO-TI-linux_2.8.6.deb
```
- Red Hat-based GNU/Linux distributions:
```bash
sudo dnf -i MZD-AIO-TI-linux_2.8.6.rpm
```

9. (Optional) Remove `podman` images and containers.
```bash
podman rmi --force <IMAGE_ID> <IMAGE_ID>
```
11 changes: 11 additions & 0 deletions scripts/build_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -xue

# Save the current working directory to the stack and change the working directory to '/work'
pushd /work

# Build '.deb', '.rpm' and '.AppImage' files
npm run-script build:linux:x64

# Move compiled packages to the output folder
mv releases/*.{deb,rpm,AppImage} /output
12 changes: 0 additions & 12 deletions scripts/build_linux_deb.sh

This file was deleted.

7 changes: 0 additions & 7 deletions scripts/build_linux_deb_helper.sh

This file was deleted.