Skip to content

Commit

Permalink
Auto install any dependencies (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohsayan committed Jun 16, 2021
1 parent ce9d830 commit c2030d6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
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

0 comments on commit c2030d6

Please sign in to comment.