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

Build: Auto install any dependencies #174

Merged
merged 1 commit into from
Jun 16, 2021
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
9 changes: 0 additions & 9 deletions .github/workflows/test-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,6 @@ jobs:
rustup target add ${{ matrix.rust }}
if: env.IS_MD_FILE == 'false'

- name: Install 32-bit tools (Linux)
run: |
sudo apt update && sudo apt install gcc-multilib -y
if: runner.os == 'Linux'

- name: Run Tests
run: make test
env:
Expand Down Expand Up @@ -263,10 +258,6 @@ jobs:
${{ matrix.rust }}-target-
if: env.IS_MD_FILE == 'false'

- name: Install MUSL tools
run: sudo apt-get update && sudo apt-get install musl-tools -y
if: runner.os == 'Linux'

- name: Install Rust
run: |
rustup default stable
Expand Down
27 changes: 23 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
ADDITIONAL_SOFTWARE=
TARGET_ARG =
ifneq ($(origin TARGET),undefined)
TARGET_ARG +=--target ${TARGET}
ifeq ($(TARGET),x86_64-unknown-linux-musl)
# we need musl-tools for 64-bit musl targets
ADDITIONAL_SOFTWARE += sudo apt-get update && sudo apt install musl-tools -y
endif
ifeq ($(TARGET),i686-unknown-linux-gnu)
# we need gcc-multilib on 32-bit linux targets
ADDITIONAL_SOFTWARE += sudo apt-get update && sudo apt install gcc-multilib -y
endif
endif

# display a message if no additional packages are required for this target
ifeq ($(ADDITIONAL_SOFTWARE),)
ADDITIONAL_SOFTWARE += echo "info: No additional software required for this target"
endif

BUILD_VERBOSE = cargo build --verbose $(TARGET_ARG)
Expand Down Expand Up @@ -41,22 +55,27 @@ ifneq ($(OS),Windows_NT)
START_COMMAND += &
endif

build:
.pre:
@echo "===================================================================="
@echo "Installing any additional dependencies"
@echo "===================================================================="
@$(ADDITIONAL_SOFTWARE)
build: .pre
@echo "===================================================================="
@echo "Building all binaries in debug mode (unoptimized)"
@echo "===================================================================="
@$(BUILD_COMMAND)
build-server:
.build-server: .pre
@echo "===================================================================="
@echo "Building server binary in debug mode (unoptimized)"
@echo "===================================================================="
@$(BUILD_SERVER_COMMAND)
release:
release: .pre
@echo "===================================================================="
@echo "Building all binaries in release mode (optimized)"
@echo "===================================================================="
cargo build --release --verbose $(TARGET_ARG)
test: build-server
test: .build-server
@echo "===================================================================="
@echo "Starting database server in background"
@echo "===================================================================="
Expand Down