Merge pull request 'feature/documentation_update' (#4) from feature/documentation_update into develop

Reviewed-on: #4
This commit is contained in:
David 2024-05-18 17:08:33 +02:00
commit 916b229645
3 changed files with 207 additions and 12 deletions

112
BUILD.md Normal file
View File

@ -0,0 +1,112 @@
# Build Instructions
Instructions for building this repository on Linux.
## Table of Contents
- [Build Instructions](#build-instructions)
- [Table of Contents](#table-of-contents)
- [Contributing to the Repository](#contributing-to-the-repository)
- [Repository Content](#repository-content)
- [Building on Linux](#building-on-linux)
- [Linux Development Environment Requirements](#linux-development-environment-requirements)
- [Required Package List](#required-package-list)
- [Install and Prepare Required Rust Version](#install-and-prepare-required-rust-version)
- [Required macOS SDK](#required-macos-sdk)
- [Build and Use macOS SDK from Xcode](#build-and-use-macos-sdk-from-xcode)
- [Build the Project](#build-the-project)
## Contributing to the Repository
If you intend to contribute, the preferred workflow is for you to develop your contribution in a fork of this repository in your GitHub account and then submit a pull request.
## Repository Content
This repository contains the source code necessary to build warp-packer for different platforms and architectures.
## Building on Linux
### Linux Development Environment Requirements
This repository has been built and tested on Debian 12.5 (Bookworm) on an AMD64 architecture.
#### Required Package List
```bash
apt install curl maven clang cmake libssl-dev zlib1g-dev liblzma-dev libbz2-dev gcc-aarch64-linux-gnu gcc-mingw-w64-x86-64-win32
```
#### Install and Prepare Required Rust Version
This repository has been built and tested with Rust version 1.78.
To install the newest version, run the following command:
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
If a newer version doesn't work, a specific version can be installed with the following command:
```bash
$ curl --proto '=https' --tls1.2 -sSf https://sh.rustup.rs/ | sh -s --default-toolchain=1.78.0
```
For more information see this [GitHub Issue](https://github.com/rust-lang/rustup/issues/2882).
After installing, run the following commands to get the necessary targets:
```bash
rustup target add x86_64-apple-darwin
rustup target add aarch64-unknown-linux-gnu
rustup target add x86_64-pc-windows-gnu
```
#### Required macOS SDK
To build warp-packer for the target x86_64-apple-darwin, a macOS SDK is needed. The repository has been built and tested with MacOSX10.12 SDK.
There are several GitHub repositories available that contain different SDK versions, but they all seem to miss the header files. So it is recommended to download it from Apple's website.
The macOS SDK is integrated into Xcode, and this repository has been built and tested with Xcode version 8.3.3.
##### Build and Use macOS SDK from Xcode
To build and use the macOS SDK from Xcode, [osxcross](https://github.com/tpoechtrager/osxcross) will be used.
Download osxcross:
```bash
git clone https://github.com/tpoechtrager/osxcross.git
```
Extract macOS SDK from Xcode (see [here](https://github.com/tpoechtrager/osxcross?tab=readme-ov-file#packing-the-sdk-on-linux---method-1-xcode--80)):
```bash
<path/to>/osxcross/tools/gen_sdk_package_pbzx.sh <path/to>/Xcode_8.3.3.xip
```
Hint: This method may require up to 45 GB of free disk space. An SSD is recommended for this method.
Copy or move the SDK into the `<path/to>/osxcross/tarballs/` directory.
Run:
```bash
UNATTENDED=yes OSX_VERSION_MIN=10.12 ./build.sh
```
to create the macOS cross toolchain.
Add the target/bin folder to your PATH environment variable:
```bash
PATH="<path/to>/osxcross/target/bin:$PATH"
```
#### Build the Project
Clone the project and within the project directory, run:
```bash
make
```
to start the build.
The compiled warp-packer files are in the folder:
```bash
<path/to>/warp/target/<target>/release/warp-packer
```
e.g.
```bash
warp/target/aarch64-unknown-linux-gnu/release/warp-packer
```

83
INSTALL.md Normal file
View File

@ -0,0 +1,83 @@
# Installation Instructions
Instructions for installing the warp-packer executable on Linux, Mac, and Windows.
## Table of Contents
- [Installation Instructions](#installation-instructions)
- [Table of Contents](#table-of-contents)
- [Linux](#linux)
- [Mac](#mac)
- [Windows](#windows)
## Linux
1. **Copy the warp-packer executable to a directory in your PATH:**
For example, you can copy it to `/usr/local/bin`:
```sh
sudo cp /path/to/warp-packer /usr/local/bin/
```
2. **Ensure the warp-packer executable has the correct permissions:**
Make the file executable:
```sh
sudo chmod +x /usr/local/bin/warp-packer
```
3. **Verify the installation:**
Check that the executable is in your PATH and works correctly:
```sh
warp-packer --version
```
## Mac
1. **Copy the warp-packer executable to a directory in your PATH:**
For example, you can copy it to `/usr/local/bin`:
```sh
sudo cp /path/to/warp-packer /usr/local/bin/
```
2. **Ensure the warp-packer executable has the correct permissions:**
Make the file executable:
```sh
sudo chmod +x /usr/local/bin/warp-packer
```
3. **Verify the installation:**
Check that the executable is in your PATH and works correctly:
```sh
warp-packer --version
```
## Windows
1. **Copy the warp-packer executable to a directory in your PATH:**
For example, you can copy it to `C:\Program Files\warp-packer`:
```powershell
Copy-Item -Path "C:\path\to\warp-packer.exe" -Destination "C:\Program Files\warp-packer\"
```
2. **Add the directory to your PATH environment variable:**
- Open the Start Search, type in "env", and select "Edit the system environment variables".
- In the System Properties window, click on the "Environment Variables..." button.
- In the Environment Variables window, under "System variables", find the `Path` variable, select it, and click "Edit...".
- In the Edit Environment Variable window, click "New" and add the path to the directory where you copied the warp-packer executable (`C:\Program Files\warp-packer\`).
- Click "OK" to close all windows.
3. **Verify the installation:**
Open a new Command Prompt and check that the executable is in your PATH and works correctly:
```cmd
warp-packer --version
```
By following these steps, you will have the warp-packer executable installed and ready to use on Linux, Mac, and Windows.

View File

@ -85,7 +85,7 @@ dgiagio@X1:~/Devel$ chmod +x warp-packer
**Create your self-contained application** **Create your self-contained application**
```sh ```sh
dgiagio@X1:~/Devel$ ./warp-packer --arch linux-x64 --input_dir myapp --exec launch --output myapp.bin dgiagio@X1:~/Devel$ ./warp-packer pack --arch linux-x64 --input-dir myapp --exec launch --output myapp.bin
dgiagio@X1:~/Devel$ chmod +x myapp.bin dgiagio@X1:~/Devel$ chmod +x myapp.bin
``` ```
@ -170,7 +170,7 @@ Diegos-iMac:Devel dgiagio$ chmod +x warp-packer
**Create your self-contained application** **Create your self-contained application**
```sh ```sh
Diegos-iMac:Devel dgiagio$ ./warp-packer --arch macos-x64 --input_dir myapp --exec launch --output myapp.bin Diegos-iMac:Devel dgiagio$ ./warp-packer pack --arch macos-x64 --input-dir myapp --exec launch --output myapp.bin
Diegos-iMac:Devel dgiagio$ chmod +x myapp.bin Diegos-iMac:Devel dgiagio$ chmod +x myapp.bin
``` ```
@ -250,7 +250,7 @@ PS C:\Users\Diego\Devel> [Net.ServicePointManager]::SecurityProtocol = "tls12, t
**Create your self-contained application** **Create your self-contained application**
```powershell ```powershell
PS C:\Users\Diego\Devel> .\warp-packer --arch windows-x64 --input_dir .\myapp\ --exec launch.cmd --output myapp.exe PS C:\Users\Diego\Devel> .\warp-packer --arch windows-x64 --input-dir .\myapp\ --exec launch.cmd --output myapp.exe
``` ```
**Run your self-contained application** **Run your self-contained application**
@ -299,7 +299,7 @@ dgiagio@X1:~/Devel/myapp$ chmod +x warp-packer
**Create your self-contained application** **Create your self-contained application**
```sh ```sh
dgiagio@X1:~/Devel/myapp$ ./warp-packer --arch linux-x64 --input_dir bin/Release/netcoreapp2.1/linux-x64/publish --exec myapp --output myapp dgiagio@X1:~/Devel/myapp$ ./warp-packer pack --arch linux-x64 --input-dir bin/Release/netcoreapp2.1/linux-x64/publish --exec myapp --output myapp
dgiagio@X1:~/Devel/myapp$ chmod +x myapp dgiagio@X1:~/Devel/myapp$ chmod +x myapp
``` ```
@ -351,7 +351,7 @@ Diegos-iMac:myapp dgiagio$ chmod +x warp-packer
**Create your self-contained application** **Create your self-contained application**
```sh ```sh
Diegos-iMac:myapp dgiagio$ ./warp-packer --arch macos-x64 --input_dir bin/Release/netcoreapp2.1/osx-x64/publish --exec myapp --output myapp Diegos-iMac:myapp dgiagio$ ./warp-packer pack --arch macos-x64 --input-dir bin/Release/netcoreapp2.1/osx-x64/publish --exec myapp --output myapp
Diegos-iMac:myapp dgiagio$ chmod +x myapp Diegos-iMac:myapp dgiagio$ chmod +x myapp
``` ```
@ -402,7 +402,7 @@ PS C:\Users\Diego\Devel\myapp> [Net.ServicePointManager]::SecurityProtocol = "tl
**Create your self-contained application** **Create your self-contained application**
```powershell ```powershell
PS C:\Users\Diego\Devel\myapp> .\warp-packer --arch windows-x64 --input_dir bin/Release/netcoreapp2.1/win10-x64/publish --exec myapp.exe --output myapp.exe PS C:\Users\Diego\Devel\myapp> .\warp-packer --arch windows-x64 --input-dir bin/Release/netcoreapp2.1/win10-x64/publish --exec myapp.exe --output myapp.exe
``` ```
**Run your self-contained application** **Run your self-contained application**
@ -456,18 +456,18 @@ Hello, world.
**Download a JRE** **Download a JRE**
There are prebuilt JREs over on [AdoptOpenJDK](https://adoptopenjdk.net). There are prebuilt JREs over on [AdoptOpenJDK](https://adoptium.net).
Here we use JRE 8: Here we use JRE 8:
``` ```
wget -N https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u202-b08/OpenJDK8U-jre_x64_linux_hotspot_8u202b08.tar.gz wget -N https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u412-b08/OpenJDK8U-jre_x64_linux_hotspot_8u412b08.tar.gz
``` ```
Unpack it: Unpack it:
``` ```
tar -xvf OpenJDK8U-jre_x64_linux_hotspot_8u202b08.tar.gz tar -xvf OpenJDK8U-jre_x64_linux_hotspot_8u412b08.tar.gz
``` ```
**Create a bundle** **Create a bundle**
@ -476,7 +476,7 @@ We need to create a folder containing: our compiled code, the JRE and a launch s
``` ```
mkdir bundle mkdir bundle
cp -r ./jdk8u202-b08-jre ./bundle/jre cp -r ./jdk8u412-b08-jre ./bundle/jre
cp app.jar ./bundle/app.jar cp app.jar ./bundle/app.jar
touch bundle/run.sh touch bundle/run.sh
chmod +x ./bundle/run.sh chmod +x ./bundle/run.sh
@ -513,7 +513,7 @@ $ chmod +x ./warp-packer
**Create your self-contained application** **Create your self-contained application**
```bash ```bash
$ ./warp-packer --arch linux-x64 --input_dir bundle --exec run.sh --output app.bin $ ./warp-packer pack --arch linux-x64 --input-dir bundle --exec run.sh --output app.bin
$ chmod +x app.bin $ chmod +x app.bin
``` ```
@ -542,7 +542,7 @@ The performance characteristics of the generated self-contained application is r
### Packages cache location ### Packages cache location
- Linux: `$HOME/.local/share/warp/packages` - Linux: `$HOME/.local/share/warp/packages`
- macOS: `$HOME/Library/Application Support/warp/packges` - macOS: `$HOME/Library/Application Support/warp/packages`
- Windows: `%LOCALAPPDATA%\warp\packages` - Windows: `%LOCALAPPDATA%\warp\packages`
### Runners cache location ### Runners cache location