Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
fix(build/electron): build the current branch
Browse files Browse the repository at this point in the history
Currently, `make linux` and `make windows` download and build the
`master` branch, ignoring any changes in the local repository.  This
change makes these commands build the local repository instead.
  • Loading branch information
Ben Schwartz committed Jan 19, 2023
1 parent 50907fd commit f16a5c1
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ GOBIN=$(CURDIR)/bin
GOMOBILE=$(GOBIN)/gomobile
# Add GOBIN to $PATH so `gomobile` can find `gobind`.
GOBIND=env PATH="$(GOBIN):$(PATH)" "$(GOMOBILE)" bind
IMPORT_PATH=github.com/Jigsaw-Code/outline-go-tun2socks
IMPORT_HOST=github.com
IMPORT_PATH=$(IMPORT_HOST)/Jigsaw-Code/outline-go-tun2socks

.PHONY: android apple apple_future linux windows intra clean clean-all

Expand Down Expand Up @@ -41,27 +42,29 @@ $(BUILDDIR)/apple_future/Tun2socks.xcframework: $(GOMOBILE)
XGO=$(GOBIN)/xgo
TUN2SOCKS_VERSION=v1.16.11
XGO_LDFLAGS='-s -w -X main.version=$(TUN2SOCKS_VERSION)'
ELECTRON_PATH=$(IMPORT_PATH)/outline/electron
ELECTRON_PKG=outline/electron


LINUX_BUILDDIR=$(BUILDDIR)/linux

linux: $(LINUX_BUILDDIR)/tun2socks

$(LINUX_BUILDDIR)/tun2socks: $(XGO)
mkdir -p "$(LINUX_BUILDDIR)"
$(XGO) -ldflags $(XGO_LDFLAGS) --targets=linux/amd64 -dest "$(LINUX_BUILDDIR)" "$(ELECTRON_PATH)"
mv "$(LINUX_BUILDDIR)/electron-linux-amd64" "$@"
mkdir -p "$(LINUX_BUILDDIR)/$(IMPORT_PATH)"
$(XGO) -ldflags $(XGO_LDFLAGS) --targets=linux/amd64 -dest "$(LINUX_BUILDDIR)" -pkg $(ELECTRON_PKG) .
mv "$(LINUX_BUILDDIR)/$(IMPORT_PATH)-linux-amd64" "$@"
rm -r "$(LINUX_BUILDDIR)/$(IMPORT_HOST)"


WINDOWS_BUILDDIR=$(BUILDDIR)/windows

windows: $(WINDOWS_BUILDDIR)/tun2socks.exe

$(WINDOWS_BUILDDIR)/tun2socks.exe: $(XGO)
mkdir -p "$(WINDOWS_BUILDDIR)"
$(XGO) -ldflags $(XGO_LDFLAGS) --targets=windows/386 -dest "$(WINDOWS_BUILDDIR)" "$(ELECTRON_PATH)"
mv "$(WINDOWS_BUILDDIR)/electron-windows-386.exe" "$@"
mkdir -p "$(WINDOWS_BUILDDIR)/$(IMPORT_PATH)"
$(XGO) -ldflags $(XGO_LDFLAGS) --targets=windows/386 -dest "$(WINDOWS_BUILDDIR)" -pkg $(ELECTRON_PKG) .
mv "$(WINDOWS_BUILDDIR)/$(IMPORT_PATH)-windows-386.exe" "$@"
rm -r "$(WINDOWS_BUILDDIR)/$(IMPORT_HOST)"


$(GOMOBILE): go.mod
Expand Down

0 comments on commit f16a5c1

Please sign in to comment.