diff --git a/Makefile b/Makefile index b0d0a38..9decd9c 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,9 @@ $(BUILD_DIR)/macos-arm64/$(BINARY_NAME): $(BUILD_DIR)/linux-amd64/$(BINARY_NAME): CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$(LDFLAGS)" -o $@ $(GO_BUILDFLAGS) ./cmd/admin-helper/ +$(BUILD_DIR)/linux-arm64/$(BINARY_NAME): + CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="$(LDFLAGS)" -o $@ $(GO_BUILDFLAGS) ./cmd/admin-helper/ + $(BUILD_DIR)/windows-amd64/$(BINARY_NAME).exe: CGO_ENABLED=0 GOARCH=amd64 GOOS=windows go build -ldflags="$(LDFLAGS)" -o $@ $(GO_BUILDFLAGS) ./cmd/admin-helper/ @@ -48,7 +51,7 @@ $(BUILD_DIR)/macos-universal/$(BINARY_NAME): $(BUILD_DIR)/macos-amd64/$(BINARY_N cd $(BUILD_DIR) && $(TOOLS_BINDIR)/makefat macos-universal/$(BINARY_NAME) macos-amd64/$(BINARY_NAME) macos-arm64/$(BINARY_NAME) .PHONY: cross ## Cross compiles all binaries -cross: $(BUILD_DIR)/macos-amd64/$(BINARY_NAME) $(BUILD_DIR)/macos-arm64/$(BINARY_NAME) $(BUILD_DIR)/linux-amd64/$(BINARY_NAME) $(BUILD_DIR)/windows-amd64/$(BINARY_NAME).exe +cross: $(BUILD_DIR)/macos-amd64/$(BINARY_NAME) $(BUILD_DIR)/macos-arm64/$(BINARY_NAME) $(BUILD_DIR)/linux-amd64/$(BINARY_NAME) $(BUILD_DIR)/linux-arm64/$(BINARY_NAME) $(BUILD_DIR)/windows-amd64/$(BINARY_NAME).exe .PHONY: macos-universal ## Creates macOS universal binary macos-universal: lint test $(BUILD_DIR)/macos-universal/$(BINARY_NAME) @@ -56,7 +59,8 @@ macos-universal: lint test $(BUILD_DIR)/macos-universal/$(BINARY_NAME) .PHONY: release release: clean lint test cross macos-universal mkdir $(RELEASE_DIR) - cp $(BUILD_DIR)/linux-amd64/$(BINARY_NAME) $(RELEASE_DIR)/$(BINARY_NAME)-linux + cp $(BUILD_DIR)/linux-amd64/$(BINARY_NAME) $(RELEASE_DIR)/$(BINARY_NAME)-linux-amd64 + cp $(BUILD_DIR)/linux-arm64/$(BINARY_NAME) $(RELEASE_DIR)/$(BINARY_NAME)-linux-arm64 cp $(BUILD_DIR)/macos-universal/$(BINARY_NAME) $(RELEASE_DIR)/$(BINARY_NAME)-darwin cp $(BUILD_DIR)/windows-amd64/$(BINARY_NAME).exe $(RELEASE_DIR)/$(BINARY_NAME)-windows.exe pushd $(RELEASE_DIR) && sha256sum * > sha256sum.txt && popd diff --git a/crc-admin-helper.spec.in b/crc-admin-helper.spec.in index ec8515c..9d94a70 100644 --- a/crc-admin-helper.spec.in +++ b/crc-admin-helper.spec.in @@ -18,10 +18,18 @@ CRC's helper with administrative privileges} %global golicenses LICENSE %global godocs *.md +%ifarch x86_64 +%global gohostarch amd64 +%endif +%ifarch aarch64 +%global gohostarch arm64 +%endif + Name: %{goname} Release: 1%{?dist} Summary: CRC's helper with administrative privileges License: MIT +ExclusiveArch: x86_64 aarch64 URL: %{gourl} Source0: %{gosource} @@ -52,10 +60,11 @@ make VERSION=%{version} GO_LDFLAGS="-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr %install # with fedora macros: gopkginstall install -m 0755 -vd %{buildroot}%{_bindir} -install -m 0755 -vp %{gobuilddir}/src/%{goipath}/out/linux-amd64/crc-admin-helper %{buildroot}%{_bindir}/ +install -m 0755 -vp %{gobuilddir}/src/%{goipath}/out/linux-%{gohostarch}/crc-admin-helper %{buildroot}%{_bindir}/ install -d %{buildroot}%{_datadir}/%{name}-redistributable/{linux,macos,windows} -install -m 0755 -vp %{gobuilddir}/src/%{goipath}/out/linux-amd64/crc-admin-helper %{buildroot}%{_datadir}/%{name}-redistributable/linux/ +install -m 0755 -vp %{gobuilddir}/src/%{goipath}/out/linux-amd64/crc-admin-helper %{buildroot}%{_datadir}/%{name}-redistributable/linux/%{name}-amd64 +install -m 0755 -vp %{gobuilddir}/src/%{goipath}/out/linux-arm64/crc-admin-helper %{buildroot}%{_datadir}/%{name}-redistributable/linux/%{name}-arm64 install -m 0755 -vp %{gobuilddir}/src/%{goipath}/out/windows-amd64/crc-admin-helper.exe %{buildroot}%{_datadir}/%{name}-redistributable/windows/ install -m 0755 -vp %{gobuilddir}/src/%{goipath}/out/macos-universal/crc-admin-helper %{buildroot}%{_datadir}/%{name}-redistributable/macos/