Skip to content

Commit

Permalink
feat: Handle arguments to build.sh
Browse files Browse the repository at this point in the history
- Pass on arguments to build.sh to the Makefile
- Improve Makefile, so it doesn't need to copy the library
  • Loading branch information
ChristianTacke committed May 26, 2024
1 parent 6304b6b commit 3e084b5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
22 changes: 13 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
.PHONY: all build_rust copy_library build_go clean
.PHONY: all clean

all: build_rust copy_library build_go
GO_BINARY=mautrix-signal

all: $(GO_BINARY)

LIBRARY_FILENAME=libsignal_ffi.a
RUST_DIR=pkg/libsignalgo/libsignal
GO_BINARY=mautrix-signal

# TODO fix linking with debug library
#ifneq ($(DBG),1)
Expand All @@ -13,16 +14,19 @@ RUST_TARGET_SUBDIR=release
#RUST_TARGET_SUBDIR=debug
#endif

build_rust:
./build-rust.sh
RUST_LIBRARY_DIR=$(RUST_DIR)/target/$(RUST_TARGET_SUBDIR)
RUST_LIBRARY=$(RUST_LIBRARY_DIR)/$(LIBRARY_FILENAME)

copy_library:
cp $(RUST_DIR)/target/$(RUST_TARGET_SUBDIR)/$(LIBRARY_FILENAME) .
$(RUST_LIBRARY):
./build-rust.sh

build_go:
LIBRARY_PATH="$${LIBRARY_PATH}:." ./build-go.sh
$(GO_BINARY): $(RUST_LIBRARY)
LIBRARY_PATH="${RUST_LIBRARY_DIR}:$${LIBRARY_PATH}" \
./build-go.sh $(GO_EXTRA_OPTS)

clean:
rm -f ./$(LIBRARY_FILENAME)
cd $(RUST_DIR) && cargo clean
rm -f $(GO_BINARY)

.PHONY: $(RUST_LIBRARY) $(GO_BINARY)
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
git submodule init
git submodule update
make
make GO_EXTRA_OPTS="$*"

0 comments on commit 3e084b5

Please sign in to comment.