1
0
Fork 0

Init repo

This commit is contained in:
gardouille 2023-08-07 18:16:38 +02:00
commit 520f161fa9
Signed by: gardouille
GPG Key ID: E759BAA22501AF32
6 changed files with 164 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
target/

5
LICENSE Normal file
View File

@ -0,0 +1,5 @@
Copyright 2023-2023 Gardouille
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
http://www.wtfpl.net/

20
README.md Normal file
View File

@ -0,0 +1,20 @@
# exa-docker-build
This repository contains the source to build [Exa](https://github.com/ogham/exa).
## Usage Docker
If you have [Docker](https://www.docker.com/) installed locally, just run the following:
```bash
user@hostname$ ./build-in-container.sh
```
By default this will build the last version on Debian Bookworm and put the
archive to `target/` directory.
## Build on current host
```bash
user@hostname$ ./build.sh
```

30
build-in-container.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
set -eu
TARGET="$(dirname "$0" | xargs realpath)"
IMAGE="debian:bookworm"
while getopts "v:i:h" opt
do
case "$opt" in
i)
IMAGE="$OPTARG"
;;
h)
echo "Usage: $0 [-i image]"
exit 0
;;
*)
exit 1
;;
esac
done
docker run --rm \
--name exa-build-$$ \
-v "$TARGET:/target" \
-w /target \
--user root \
"$IMAGE" \
sh build.sh

54
build.sh Executable file
View File

@ -0,0 +1,54 @@
#!/bin/bash
set -xeu
DEBIAN_FRONTEND=noninteractive
TARGET="$PWD"
export DEBIAN_FRONTEND
dependencies() {
# Update system and install basic tools
apt-get update -yq && apt-get install -yq aptitude curl git wget
# Install dependencies for Exa
aptitude --quiet --assume-yes install gcc libgit2-dev
}
install_rust() {
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host x86_64-unknown-linux-gnu --default-toolchain nightly
. ~/.cargo/env
}
get_exa_sources() {
# Clone Exa repo
cd "$(mktemp -d)"
git clone https://github.com/ogham/exa
cd exa
}
build_exa() {
# Build
cargo build --release
# Test
cargo test
# Move to previous directory
#cd -
}
copy() {
TARGET_UID="$(stat --printf %u "$TARGET")"
TARGET_GID="$(stat --printf %g "$TARGET")"
install -o "$TARGET_UID" -g "$TARGET_GID" -t "$TARGET/target" target/release/exa
}
main() {
dependencies
install_rust
get_exa_sources
build_exa
copy
}
main

54
entrypoint.sh Executable file
View File

@ -0,0 +1,54 @@
#!/bin/bash
set -xeu
DEBIAN_FRONTEND=noninteractive
TARGET="$PWD"
export DEBIAN_FRONTEND
dependencies() {
# Update system and install basic tools
apt-get update -yq && apt-get install -yq aptitude curl git wget
# Install dependencies for Exa
aptitude --quiet --assume-yes install gcc libgit2-dev
}
install_rust() {
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host x86_64-unknown-linux-gnu --default-toolchain nightly
. ~/.cargo/env
}
get_exa_sources() {
# Clone Exa repo
cd "$(mktemp -d)"
git clone https://github.com/ogham/exa
cd exa
}
build_exa() {
## Build
cargo build --release
# Test
cargo test
## Move to previous directory
cd -
}
copy() {
TARGET_UID="$(stat --printf %u "$TARGET")"
TARGET_GID="$(stat --printf %g "$TARGET")"
install -o "$TARGET_UID" -g "$TARGET_GID" -t "$TARGET/target" /*.tar.gz
}
main() {
dependencies
install_rust
get_exa_sources
build_exa
copy
}
main