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

ci #51

Open
gedw99 opened this issue Jul 10, 2023 · 5 comments
Open

ci #51

gedw99 opened this issue Jul 10, 2023 · 5 comments

Comments

@gedw99
Copy link

gedw99 commented Jul 10, 2023

hey @inkeliz

README looks good btw..

Saw all the hardware you test on and wondering how our doing it. I did see a github workflow, so curious if i can also do it

@gedw99
Copy link
Author

gedw99 commented Jul 10, 2023

BTW here is my gio builder that makes up for some of the bits that gio cmd does not do yet:

I have to copy and past because .mk files can't be uploaded.

I also have one for signing.

If you want it let me know, and i can PR. it also runs in github actions to make gio builds for all platforms.

# GIO
# https://github.com/gioui

# https://github.com/gioui/gio-cmd

# TODO: 
# Start using Bingo: https://github.com/owncloud/ocis/tree/master/.bingo, so that versions of binary"s are controlled by go-mod on a per project basis.

# TODO: Fyne has packaging we can use: https://github.com/fyne-io/fyne/tree/master/cmd/fyne/internal/commands

### OS

GIO_GO_OS=$(shell $(GIO_GO_BIN_NAME) env GOOS)
GIO_GO_ARCH=$(shell $(GIO_GO_BIN_NAME) env GOARCH)
GIO_GO_TOOLDIR=$(shell $(GIO_GO_BIN_NAME) env GOTOOLDIR)
GIO_GO_PATH=$(shell $(GIO_GO_BIN_NAME) env GOPATH)

# the place go install puts binaries.
#ifndef $(GOPATH)
#    GOPATH=$(shell go env GOPATH)
#    export GOPATH
#endif
#GIO_GO_BIN_FSPATH=$(GOPATH)/bin

### BINS

GIO_GO_BIN_NAME=$(GIO_SRC_GO_BIN_NAME)
GIO_GO_BIN_WHICH=$(shell which $(GIO_GO_BIN_NAME))
GIO_GO_BIN_WHICH_VERSION=$(shell $(GIO_GO_BIN_NAME) version)
GIO_GO_BIN_WHICH_GO_VERSION=$(shell $(GIO_GO_BIN_NAME) version $(GIO_GO_BIN_WHICH))

GIO_BIN=gogio
GIO_BIN_VERSION=latest
GIO_BIN_WHICH=$(shell which $(GIO_BIN))
GIO_BIN_WHICH_GO_VERSION=$(shell $(GIO_GO_BIN_NAME) version $(GIO_BIN_WHICH))

GIO_GARBLE_BIN_NAME=garble
GIO_GARBLE_BIN_VERSION=latest
GIO_GARBLE_BIN_WHICH=$(shell which $(GIO_GARBLE_BIN_NAME))
GIO_GARBLE_BIN_WHICH_VERSION=$(shell $(GIO_GARBLE_BIN_NAME) version)
GIO_GARBLE_BIN_WHICH_GO_VERSION=$(shell $(GIO_GO_BIN_NAME) version $(GIO_GARBLE_BIN_WHICH))

# https://github.com/a8m/tree
GIO_TREE_BIN_NAME=tree
GIO_TREE_BIN_VERSION=latest
GIO_TREE_BIN_WHICH=$(shell which $(GIO_TREE_BIN_NAME))
GIO_TREE_BIN_WHICH_VERSION=$(shell $(GIO_TREE_BIN_NAME) version)
GIO_TREE_BIN_WHICH_GO_VERSION=$(shell $(GIO_GO_BIN_NAME) version $(GIO_TREE_BIN_WHICH))


### VARIABLES

# where to put the standard templates. Might want them elsewhere.
GIO_SRC_TEMPLATES_FSPATH=

## OVERRIDE variables
# where to look for gio golang soure code to build from.
GIO_SRC_FSPATH=$(PWD)
GIO_SRC_NAME=ex
GIO_SRC_GO_BIN_NAME=go
# or GIO_SRC_GO_BIN_NAME=gotip

### VARIABLES

# COMPUTED variables

GIO_SRC=$(GIO_SRC_FSPATH)/$(GIO_SRC_NAME)

# build paths
GIO_BUILD_FSPATH=$(GIO_SRC_FSPATH)/.bin/giobuild
GIO_BUILD_RELEASE_FSPATH=$(GIO_SRC_FSPATH)/.bin/giobuild-release

# templates
_GIO_SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
_GIO_TEMPLATES_SOURCE=$(_GIO_SELF_DIR)templates/gio
_GIO_TEMPLATES_TARGET=$(PWD)/.templates/gio


## path to builds for easy running.
GIO_RUN_FSPATH=?

ifeq ($(GO_OS),windows)
	GIO_RUN_FSPATH=$(GIO_BUILD_WINDOWS_AMD64_PACK)
endif

ifeq ($(GO_OS),darwin)
	GIO_RUN_FSPATH=$(GIO_BUILD_DARWIN_AMD64_PACK)
endif

ifeq ($(GO_OS),linux)
	GIO_RUN_FSPATH=$(GIO_BUILD_LINUX_AMD64_PACK)
endif 

GIO_RUN_RELEASE_FSPATH=?


ifeq ($(GO_OS),windows)
	GIO_RUN_RELEASE_FSPATH=$(GIO_BUILD_WINDOWS_RELEASE_AMD64_PACK)
endif

ifeq ($(GO_OS),darwin)
	GIO_RUN_RELEASE_FSPATH=$(GIO_BUILD_DARWIN_RELEASE_AMD64_PACK)
endif

ifeq ($(GO_OS),linux)
	GIO_RUN_RELEASE_FSPATH=$(GIO_BUILD_LINUX_RELEASE_AMD64_PACK)
endif 


## Prints the variables used.
gio-print:
	@echo ""
	@echo --- OS ---
	@echo "GIO_GO_OS:                            $(GIO_GO_OS)"
	@echo "GIO_GO_ARCH:                          $(GIO_GO_ARCH)"
	@echo "GIO_GO_TOOLDIR:                       $(GIO_GO_TOOLDIR)"
	@echo "GIO_GO_PATH:                          $(GIO_GO_PATH)"

	@echo ""
	@echo "--- BINS ---"
	@echo "GIO_GO_BIN_NAME:                      $(GIO_GO_BIN_NAME)"
	@echo "GIO_GO_BIN_WHICH                      $(GIO_GO_BIN_WHICH)"
	@echo "GIO_GO_BIN_WHICH_VERSION:             $(GIO_GO_BIN_WHICH_VERSION)"
	@echo "GIO_GO_BIN_WHICH_GO_VERSION:          $(GIO_GO_BIN_WHICH_GO_VERSION)"
	
	@echo ""
	@echo "GIO_BIN:                              $(GIO_BIN)"
	@echo "GIO_BIN_WHICH:                        $(GIO_BIN_WHICH)"
	@echo "GIO_BIN_WHICH_GO_VERSION:             $(GIO_BIN_WHICH_GO_VERSION)"
	
	@echo ""
	@echo "GIO_GARBLE_BIN_NAME:                  $(GIO_GARBLE_BIN_NAME)"
	@echo "GIO_GARBLE_BIN_VERSION                $(GIO_GARBLE_BIN_VERSION)"
	@echo "GIO_GARBLE_BIN_WHICH                  $(GIO_GARBLE_BIN_WHICH)"
	@echo "GIO_GARBLE_BIN_WHICH_VERSION          $(GIO_GARBLE_BIN_WHICH_VERSION)"
	@echo "GIO_GARBLE_BIN_WHICH_GO_VERSION       $(GIO_GARBLE_BIN_WHICH_GO_VERSION)"

	@echo ""
	@echo "GIO_TREE_BIN_NAME:                    $(GIO_TREE_BIN_NAME)"
	@echo "GIO_TREE_BIN_VERSION                  $(GIO_TREE_BIN_VERSION)"
	@echo "GIO_TREE_BIN_WHICH                    $(GIO_TREE_BIN_WHICH)"
	@echo "GIO_TREE_BIN_WHICH_VERSION            $(GIO_TREE_BIN_WHICH_VERSION)"
	@echo "GIO_TREE_BIN_WHICH_GO_VERSION         $(GIO_TREE_BIN_WHICH_GO_VERSION)"
	

	@echo ""
	@echo --- VARIABLES ---
	@echo ""
	@echo "- Override variables"
	@echo "GIO_SRC_FSPATH:                       $(GIO_SRC_FSPATH)"
	@echo "GIO_SRC_NAME:                         $(GIO_SRC_NAME)"
	@echo "GIO_SRC_GO_BIN_NAME:                  $(GIO_SRC_GO_BIN_NAME)"
	
	@echo ""
	@echo "Computed variables"
	
	@echo ""
	@echo "- build paths"
	@echo "GIO_BUILD_FSPATH:                    $(GIO_BUILD_FSPATH)"
	@echo "GIO_BUILD_RELEASE_FSPATH:            $(GIO_BUILD_RELEASE_FSPATH)"

	@echo ""
	@echo "- run paths"
	@echo "GIO_RUN_FSPATH:                     $(GIO_RUN_FSPATH)"
	@echo "GIO_RUN_RELEASE_FSPATH:             $(GIO_RUN_RELEASE_FSPATH)"

	@echo ""

gio-print-build:
	
	@echo ""
	@echo "-- ALL BUILD variables:"
	@echo ""

	$(MAKE) gio-web-print

	$(MAKE) gio-desk-windows-print

	$(MAKE) gio-desk-darwin-print

	$(MAKE) gio-ios-print

	$(MAKE) gio-android-print



## Installs all tools
gio-dep:
	@echo ""
	@echo "-- Installing gogio tool into go bin --"
	$(GIO_GO_BIN_NAME) install gioui.org/cmd/gogio@$(GIO_BIN_VERSION)
	@echo installed gogio [ $(GIO_BIN_VERSION) ] at : $(GIO_BIN_WHICH)

	@echo
	@echo "-- Installing garble"
	$(GIO_GO_BIN_NAME) install mvdan.cc/garble@$(GIO_GARBLE_BIN_VERSION)
	@echo "garble installed at : $(GIO_GARBLE_BIN_WHICH)"

	@echo
	@echo "-- Installing tree"
	$(GIO_GO_BIN_NAME) install github.com/a8m/tree/cmd/tree@$(GIO_TREE_BIN_VERSION)
	@echo "tree installed at : $(GIO_TREE_BIN_WHICH)"

gio-dep-git:
	# my fork 
	rm -rf gio-cmd
	git clone [email protected]:gedw99/gio-cmd.git -b main
	cd gio-cmd && git remote add upstream [email protected]:gioui/gio-cmd.git 
	cd gio-cmd/gogio && $(GIO_GO_BIN_NAME) build -o $(GIO_GO_BIN_FSPATH)/gogio .

	@echo installed gogio [ $(GIO_BIN_VERSION) ] at : $(GIO_BIN_WHICH)

gio-dep-git-sync:
	# for getting back upstream ...
	cd gio-cmd && git remote -v
	cd gio-cmd && git git remote add upstream [email protected]:gioui/gio-cmd.git 
	cd gio-cmd && git fetch upstream
	cd gio-cmd && git reset --hard upstream/main
	cd gio-cmd && git push origin main --force



## prints the templates 
gio-templates-print:
	@echo ""
	@echo "- templates:"
	@echo "_GIO_SELF_DIR:                      $(_GIO_SELF_DIR)"
	@echo "_GIO_TEMPLATES_SOURCE:              $(_GIO_TEMPLATES_SOURCE)"
	@echo "_GIO_TEMPLATES_TARGET:              $(_GIO_TEMPLATES_TARGET)"

## installs the standard templates
gio-templates-dep:
	@echo ""
	@echo "-- Installing GIO templates into your project --"
	mkdir -p $(_GIO_TEMPLATES_TARGET)
	cp -r $(_GIO_TEMPLATES_SOURCE) $(_GIO_TEMPLATES_TARGET)
	@echo installed gio templates  at : $(_GIO_TEMPLATES_TARGET)

gio-build-all:
	# Always do Web so we know its never broken. Its pretty fast
	$(MAKE) gio-web-build
	# These  builders fail 
	#$(MAKE) gio-wasmtiny-build
	#$(MAKE) gio-wasm-build


	$(MAKE) gio-desk-windows-build

	$(MAKE) gio-desk-darwin-build

	$(MAKE) gio-desk-linux-build

## Builds the code for Web and Desktop as a convenience
gio-build:
	# only build for OS i am on.

ifeq ($(GIO_GO_OS),windows)
	$(MAKE) gio-desk-windows-build
endif

ifeq ($(GIO_GO_OS),darwin)
	$(MAKE) gio-desk-darwin-build
endif

ifeq ($(GIO_GO_OS),linux)
	$(MAKE) gio-desk-linux-build
endif 

gio-run:

ifeq ($(GIO_GO_OS),windows)
	$(MAKE) gio-desk-windows-run
endif

ifeq ($(GIO_GO_OS),darwin)
	$(MAKE) gio-desk-darwin-run
endif

ifeq ($(GIO_GO_OS),linux)
	$(MAKE) gio-desk-linux-run
endif 
	
gio-runpack:

ifeq ($(GIO_GO_OS),windows)
	$(MAKE) gio-desk-windows-runpack
endif

ifeq ($(GIO_GO_OS),darwin)
	$(MAKE) gio-desk-darwin-runpack
endif

ifeq ($(GIO_GO_OS),linux)
	$(MAKE) gio-desk-linux-runpack
endif 



# Deletes the gio build foolder
gio-build-delete:
	rm -rf $(GIO_BUILD_FSPATH)
gio-build-release-delete:
	rm -rf $(GIO_BUILD_RELEASE_FSPATH)


### WEB

GIO_BUILD_WEB_PATH=$(GIO_BUILD_FSPATH)/web_wasm/$(GIO_SRC_NAME).web
GIO_BUILD_TINYWASM_PATH=$(GIO_BUILD_FSPATH)/web_tinywasm/$(GIO_SRC_NAME).web
GIO_BUILD_WASM_PATH=$(GIO_BUILD_FSPATH)/web_wasm/$(GIO_SRC_NAME).web

gio-web-print:
	@echo "GIO_BUILD_WEB_PATH:                 $(GIO_BUILD_WEB_PATH)"
	@echo "GIO_BUILD_TINYWASM_PATH:            $(GIO_BUILD_TINYWASM_PATH)"
	@echo "GIO_BUILD_WASM_PATH:                $(GIO_BUILD_WASM_PATH)"
	
gio-web-build:
	@echo ""
	@echo "$(GIO_SRC_NAME): js wasm ( using gio cmd )"
	cd $(GIO_SRC_FSPATH) && $(GIO_GO_BIN_NAME) generate -v ./...
	
	## TODO <title>foobar</title> is not changed in index.html despite setting the -appid
	cd $(GIO_SRC_FSPATH) && $(GIO_BIN) -target js -appid $(GIO_SRC_NAME) -icon appicon.png -o $(GIO_BUILD_WEB_PATH) .
	
gio-wasmtiny-build:
	@echo ""
	@echo "$(GIO_SRC_NAME): wasip1 wasm ( using tinygo )"
	cd $(GIO_SRC_FSPATH) && $(GIO_GO_BIN_NAME) generate -v ./...
	# also try "-scheduler=none" as it removed goroutine and speeds up build.
	cd $(GIO_SRC_FSPATH) && tinygo build -o $(GIO_BUILD_TINYWASM_PATH) -target wasm .


gio-wasm-build:
	@echo ""
	@echo "$(GIO_SRC_NAME): wasip1 wasm  ( using gotip )"

	cd $(GIO_SRC_FSPATH) && $(GIO_GO_BIN_NAME) generate -v ./...
	
	#cd $(GIO_SRC_FSPATH) && tinygo build -o $(GIO_BUILD_TINYWASM_PATH) -target wasm .

	cd $(GIO_SRC_FSPATH) && GOOS=wasip1 GOARCH=wasm $(GIO_GO_BIN_NAME) build -tags $(GIO_SRC_TAG) -o $(GIO_BUILD_WASM_PATH) .

	
### DESK

### DESK - MACOS

# debug

GIO_BUILD_DARWIN_PACK=$(GIO_BUILD_FSPATH)/darwin_amd64/$(GIO_SRC_NAME).app
GIO_BUILD_DARWIN_BIN=$(GIO_BUILD_FSPATH)/darwin_amd64/$(GIO_SRC_NAME).app//Contents/MacOS/$(GIO_SRC_NAME)

GIO_BUILD_DARWIN_AMD64_PACK=$(GIO_BUILD_FSPATH)/darwin_amd64/$(GIO_SRC_NAME).app
GIO_BUILD_DARWIN_ARM64_PACK=$(GIO_BUILD_FSPATH)/darwin_arm64/$(GIO_SRC_NAME).app
GIO_BUILD_DARWIN_AMD64_BIN=$(GIO_BUILD_DARWIN_AMD64_PACK)/Contents/MacOS/$(GIO_SRC_NAME)
GIO_BUILD_DARWIN_ARM64_BIN=$(GIO_BUILD_DARWIN_ARM64_PACK)/Contents/MacOS/$(GIO_SRC_NAME)

# release

GIO_BUILD_DARWIN_RELEASE_PACK=$(GIO_BUILD_RELEASE_FSPATH)/darwin_amd64/$(GIO_SRC_NAME).app
GIO_BUILD_DARWIN_RELEASE_BIN=$(GIO_BUILD_RELEASE_FSPATH)/darwin_amd64/$(GIO_SRC_NAME).app//Contents/MacOS/$(GIO_SRC_NAME)

GIO_BUILD_DARWIN_RELEASE_AMD64_PACK=$(GIO_BUILD_RELEASE_FSPATH)/darwin_amd64/$(GIO_SRC_NAME).app
GIO_BUILD_DARWIN_RELEASE_ARM64_PACK=$(GIO_BUILD_RELEASE_FSPATH)/darwin_arm64/$(GIO_SRC_NAME).app
GIO_BUILD_DARWIN_RELEASE_AMD64_BIN=$(GIO_BUILD_DARWIN_RELEASE_AMD64_PACK)/Contents/MacOS/$(GIO_SRC_NAME)
GIO_BUILD_DARWIN_RELEASE_ARM64_BIN=$(GIO_BUILD_DARWIN_RELEASE_ARM64_PACK)/Contents/MacOS/$(GIO_SRC_NAME)


gio-desk-darwin-print:
	@echo ""
	@echo "- gio-desk-darwin-print:"
	@echo "GIO_BUILD_DARWIN_AMD64_PACK:        $(GIO_BUILD_DARWIN_AMD64_PACK)"
	@echo "GIO_BUILD_DARWIN_ARM64_PACK:        $(GIO_BUILD_DARWIN_ARM64_PACK)"
	@echo "GIO_BUILD_DARWIN_AMD64_BIN:         $(GIO_BUILD_DARWIN_AMD64_BIN)"
	@echo "GIO_BUILD_DARWIN_ARM64_BIN:         $(GIO_BUILD_DARWIN_ARM64_BIN)"
	@echo ""
	@echo "-run:"
	@echo "GIO_BUILD_DARWIN_PACK:              $(GIO_BUILD_DARWIN_PACK)"
	@echo "GIO_BUILD_DARWIN_BIN:               $(GIO_BUILD_DARWIN_BIN)"

	# release
	
	@echo ""
	@echo "- gio-desk-darwin-release-print:"
	@echo "GIO_BUILD_DARWIN_RELEASE_AMD64_PACK:        $(GIO_BUILD_DARWIN_RELEASE_AMD64_PACK)"
	@echo "GIO_BUILD_DARWIN_RELEASE_ARM64_PACK:        $(GIO_BUILD_DARWIN_RELEASE_ARM64_PACK)"
	@echo "GIO_BUILD_DARWIN_RELEASE_AMD64_BIN:         $(GIO_BUILD_DARWIN_RELEASE_AMD64_BIN)"
	@echo "GIO_BUILD_DARWIN_RELEASE_ARM64_BIN:         $(GIO_BUILD_DARWIN_RELEASE_ARM64_BIN)"
	@echo ""
	@echo "- run:"
	@echo "GIO_BUILD_DARWIN_RELEASE_PACK:              $(GIO_BUILD_DARWIN_RELEASE_PACK)"
	@echo "GIO_BUILD_DARWIN_RELEASE_BIN:               $(GIO_BUILD_DARWIN_RELEASE_BIN)"

gio-desk-darwin-build: 
	# this packages it automatically as a .app
	cd $(GIO_SRC_FSPATH) && $(GIO_GO_BIN_NAME) generate -v ./...
	# the new way.
	# appid does change the plist Bundle identifier, and binary name inside the packaging.
	@echo ""
	@echo "darwin - packed"
	cd $(GIO_SRC_FSPATH) && $(GIO_BIN) -target macos -arch amd64 -appid $(GIO_SRC_NAME) -icon appicon.png -o $(GIO_BUILD_DARWIN_AMD64_PACK) .
	cd $(GIO_SRC_FSPATH) && $(GIO_BIN) -target macos -arch arm64 -appid $(GIO_SRC_NAME) -icon appicon.png -o $(GIO_BUILD_DARWIN_ARM64_PACK) .

	# also need without packing
	@echo ""
	@echo "darwin - binary"
	cp $(GIO_BUILD_DARWIN_AMD64_BIN) $(GIO_BUILD_FSPATH)/darwin_amd64/$(GIO_SRC_NAME)
	cp $(GIO_BUILD_DARWIN_ARM64_BIN) $(GIO_BUILD_FSPATH)/darwin_arm64/$(GIO_SRC_NAME)


gio-desk-darwin-run:
	open $(GIO_BUILD_DARWIN_BIN)
gio-desk-darwin-runpack:
	open $(GIO_BUILD_DARWIN_PACK)

# release

gio-desk-darwin-release-build:
	#cd $(GIO_SRC_FSPATH) && $(GIO_GO_BIN_NAME) generate -v ./...

	# CURRENTLY garble messes it up.
	
	# first build binary inside the pack scaffold.
	#  -debugdir=out
	mkdir -p $(GIO_BUILD_DARWIN_RELEASE_AMD64_BIN)_out
	cd $(GIO_SRC_FSPATH) && GOOS=darwin GOARCH=amd64 $(GIO_GARBLE_BIN_NAME) -debugdir=$(GIO_BUILD_DARWIN_RELEASE_AMD64_BIN)_out -tiny build .
	
	# need to copy go.mod etc in.
	cp $(GIO_SRC_FSPATH)/go.mod $(GIO_BUILD_DARWIN_RELEASE_AMD64_BIN)_out/$(GIO_SRC_NAME)
	cp $(GIO_SRC_FSPATH)/go.sum $(GIO_BUILD_DARWIN_RELEASE_AMD64_BIN)_out/$(GIO_SRC_NAME)
	cd $(GIO_BUILD_DARWIN_RELEASE_AMD64_BIN)_out/$(GIO_SRC_NAME) && $(GIO_BIN) -target macos -arch amd64 -appid $(GIO_SRC_NAME) -icon appicon.png -o $(GIO_BUILD_DARWIN_RELEASE_AMD64_PACK) .
	
	#cd $(GIO_SRC_FSPATH) && $(GIO_BIN) -target macos -arch arm64 -appid $(GIO_SRC_NAME) -icon appicon.png -o $(GIO_BUILD_DARWIN_RELEASE_ARM64_PACK) .
gio-desk-darwin-release-run:
	open $(GIO_BUILD_DARWIN_RELEASE_BIN)

gio-desk-darwin-sign-notorise:
	# still to do...
gio-desk-darwin-sign:
	# https://github.com/gioui/gio-cmd/blob/main/gogio/darwinosbuild.go
	# this inserts the signing into the built .app.
	codesign -s - $(GIO_BUILD_DARWIN_AMD64_PACK)
	codesign -s - $(GIO_BUILD_DARWIN_ARM64_PACK)
gio-desk-darwin-sign-check:
	# https://osxdaily.com/2016/03/14/verify-code-sign-apps-darwin-os-x/
	# Look at Authority values !!
	codesign -dv --verbose=4 $(GIO_BUILD_DARWIN_AMD64_PACK)
	codesign -dv --verbose=4 $(GIO_BUILD_DARWIN_ARM64_PACK)
	@echo ""
	@echo "terminal app, just to compare for now..."
	codesign -dv --verbose=4 /System/Applications/Utilities/Terminal.app
	

### DESK - WINDOWS

GIO_BUILD_WINDOWS_AMD64_PATH=$(GIO_BUILD_FSPATH)/windows_amd64/$(GIO_SRC_NAME).exe
GIO_BUILD_WINDOWS_ARM64_PATH=$(GIO_BUILD_FSPATH)/windows_arm64/$(GIO_SRC_NAME).exe
GIO_BUILD_WINDOWS_PATH=$(GIO_BUILD_FSPATH)/windows_amd64/$(GIO_SRC_NAME).exe

GIO_BUILD_WINDOWS_RELEASE_AMD64_PATH=$(GIO_BUILD_RELEASE_FSPATH)/windows_amd64/$(GIO_SRC_NAME).exe
GIO_BUILD_WINDOWS_RELEASE_ARM64_PATH=$(GIO_BUILD_RELEASE_FSPATH)/windows_arm64/$(GIO_SRC_NAME).exe
GIO_BUILD_WINDOWS_RELEASE_PATH=$(GIO_BUILD_RELEASE_FSPATH)/windows_amd64/$(GIO_SRC_NAME).exe

# NOT finished
gio-desk-windows-print:
	@echo ""
	@echo "- gio-desk-windows-print:"
	@echo "GIO_BUILD_WINDOWS_AMD64_PATH:             $(GIO_BUILD_WINDOWS_AMD64_PATH)"
	@echo "GIO_BUILD_WINDOWS_ARM64_PATH:             $(GIO_BUILD_WINDOWS_ARM64_PATH)"
	@echo "GIO_BUILD_WINDOWS_PATH:                   $(GIO_BUILD_WINDOWS_PATH)"
	@echo ""
	@echo "- gio-desk-windows-release-print:"
	@echo "GIO_BUILD_WINDOWS_RELEASE_AMD64_PATH:     $(GIO_BUILD_WINDOWS_RELEASE_AMD64_PATH)"
	@echo "GIO_BUILD_WINDOWS_RELEASE_ARM64_PATH:     $(GIO_BUILD_WINDOWS_RELEASE_ARM64_PATH)"
	@echo "GIO_BUILD_WINDOWS_RELEASE_PATH:           $(GIO_BUILD_WINDOWS_RELEASE_PATH)"

	
gio-desk-windows-pack-init:
	# TODO: 
gio-desk-windows-build:
	# this does not packaging. Its just .exe for now.
	cd $(GIO_SRC_FSPATH) && $(GIO_BIN) -target windows -arch amd64 -appid $(GIO_SRC_NAME) -icon appicon.png -o $(GIO_BUILD_WINDOWS_AMD64_PATH) .
	cd $(GIO_SRC_FSPATH) && $(GIO_BIN) -target windows -arch arm64 -appid $(GIO_SRC_NAME) -icon appicon.png -o $(GIO_BUILD_WINDOWS_ARM64_PATH) .

gio-desk-windows-release-build:
	# this does not packaging. Its just .exe for now.
	cd $(GIO_SRC_FSPATH) && $(GIO_BIN) -target windows -arch amd64 -appid $(GIO_SRC_NAME) -icon appicon.png -o $(GIO_BUILD_WINDOWS_RELEASE_AMD64_PATH) .
	cd $(GIO_SRC_FSPATH) && $(GIO_BIN) -target windows -arch arm64 -appid $(GIO_SRC_NAME) -icon appicon.png -o $(GIO_BUILD_WINDOWS_RELEASE_ARM64_PATH) .

gio-desk-windows-run:
	open $(GIO_BUILD_WINDOWS_PATH)
gio-desk-windows-release-run:
	open $(GIO_BUILD_WINDOWS_RELEASE_PATH)


### DESK - LINUX

GIO_BUILD_LINUX_AMD64_PATH=$(GIO_BUILD_FSPATH)/linux_amd64/$(GIO_SRC_NAME)
GIO_BUILD_LINUX_ARM64_PATH=$(GIO_BUILD_FSPATH)/linux_arm64/$(GIO_SRC_NAME)
GIO_BUILD_LINUX_PATH=$(GIO_BUILD_FSPATH)/linux_amd64/$(GIO_SRC_NAME)

GIO_BUILD_LINUX_RELEASE_AMD64_PATH=$(GIO_BUILD_RELEASE_FSPATH)/linux_amd64/$(GIO_SRC_NAME)
GIO_BUILD_LINUX_RELEASE_ARM64_PATH=$(GIO_BUILD_RELEASE_FSPATH)/linux_arm64/$(GIO_SRC_NAME)
GIO_BUILD_LINUX_RELEASE_PATH=$(GIO_BUILD_RELEASE_FSPATH)/linux_amd64/$(GIO_SRC_NAME)

# NOT finished
gio-desk-linux-print:
	@echo ""
	@echo "- gio-desk-linux-print:"
	@echo "GIO_BUILD_LINUX_AMD64_PATH:             $(GIO_BUILD_LINUX_AMD64_PATH)"
	@echo "GIO_BUILD_LINUX_ARM64_PATH:             $(GIO_BUILD_LINUX_ARM64_PATH)"
	@echo "GIO_BUILD_LINUX_PATH:                   $(GIO_BUILD_LINUX_PATH)"
	@echo ""
	@echo "- gio-desk-linux-release-print:"
	@echo "GIO_BUILD_LINUX_RELEASE_AMD64_PATH:     $(GIO_BUILD_LINUX_RELEASE_AMD64_PATH)"
	@echo "GIO_BUILD_LINUX_RELEASE_ARM64_PATH:     $(GIO_BUILD_LINUX_RELEASE_ARM64_PATH)"
	@echo "GIO_BUILD_LINUX_RELEASE_PATH:           $(GIO_BUILD_LINUX_RELEASE_PATH)"

	
gio-desk-linux-pack-init:
	# TODO: create scaffold maually and go build and insert bin into scaffold for now.
gio-desk-linux-build: 
	cd $(GIO_SRC_FSPATH) && GOOS=linux GOARCH=amd64 && $(GIO_GO_BIN_NAME) build -o $(GIO_BUILD_LINUX_AMD64_PATH) .
	cd $(GIO_SRC_FSPATH) && GOOS=linux GOARCH=arm64 && $(GIO_GO_BIN_NAME) build -o $(GIO_BUILD_LINUX_ARM64_PATH) .

	# gogio seems to not support linux desktop builds..
	#cd $(GIO_SRC_FSPATH) && $(GIO_BIN) -target linux -arch amd64 -appid $(GIO_SRC_NAME) -icon appicon.png -o $(GIO_BUILD_LINUX_AMD64_PATH) .
	#cd $(GIO_SRC_FSPATH) && $(GIO_BIN) -target linux -arch arm64 -appid $(GIO_SRC_NAME) -icon appicon.png -o $(GIO_BUILD_LINUX_ARM64_PATH) .
gio-desk-linux-release-build:
	cd $(GIO_SRC_FSPATH) && GOOS=linux GOARCH=amd64 && $(GIO_GO_BIN_NAME) build -o $(GIO_BUILD_LINUX_RELEASE_AMD64_PATH) .
	cd $(GIO_SRC_FSPATH) && GOOS=linux GOARCH=arm64 && $(GIO_GO_BIN_NAME) build -o $(GIO_BUILD_LINUX_RELEASE_ARM64_PATH) .
gio-desk-linux-run:
	open $(GIO_BUILD_LINUX_PATH)
gio-desk-linux-release-run:
	open $(GIO_BUILD_LINUX_RELEASE_PATH)






### IOS

GIO_BUILD_IOS_PATH=$(GIO_BUILD_FSPATH)/ios/$(GIO_SRC_NAME).ipa
GIO_BUILD_IOS_SIM_PATH=$(GIO_BUILD_FSPATH)/ios-sim/$(GIO_SRC_NAME).app

gio-ios-print:
	@echo "GIO_BUILD_IOS_PATH:                 $(GIO_BUILD_IOS_PATH)"
	@echo "GIO_BUILD_IOS_SIM_PATH:             $(GIO_BUILD_IOS_SIM_PATH)"

	# TOOO: make this an ENV variable like "GIO_IOS_DEVICE_ID", that is checked for existing and then used. 
	@echo IOS_DEVICE: $(shell idevice_id -l)
gio-ios-build:
	# -work IF you want to see the xcode generated.

	# make build dir
	mkdir -p $(GIO_BUILD_FSPATH)/ios
	
	# FAILS: nope - needs a provioning profile.
	cd $(GIO_SRC_FSPATH) && $(GIO_BIN) -work -appid gedw99.$(GIO_SRC_NAME) -buildmode exe -o $(GIO_BUILD_IOS_PATH) -target ios .
gio-ios-install:
	# see: https://www.systutorials.com/docs/lin/man/1-ideviceinstaller/
	# idevice_id -l
	cd $(GIO_SRC_FSPATH) && ideviceinstaller -i $(GIO_BUILD_IOS_PATH) --udid bdf90dc799709a013a25d0fc2df80e441df026f3

gio-ios-sim-build:
	#exe and archive
	# -work IF you want to see the xcode generated.

	# make build dir
	mkdir -p $(GIO_BUILD_FSPATH)/ios-sim/

	cd $(GIO_SRC) && $(GIO_BIN) -work -appid ??.$(GIO_SRC_NAME) -buildmode exe -o $(GIO_BUILD_IOS_SIM_PATH) -target ios .
gio-ios-sim-install:

	xcrun simctl install booted $(GIO_BUILD_IOS_SIM_PATH)


### ANDROID



GIO_BUILD_ANDROID_PATH=$(GIO_BUILD_FSPATH)/android/$(GIO_SRC_NAME).apk

gio-android-print:
	@echo "GIO_BUILD_ANDROID_PATH:             $(GIO_BUILD_ANDROID_PATH)"

gio-android-build:
	# todo: adjust buil path to be in .bin ....
	mkdir -p $(GIO_BUILD_FSPATH)/android/
	cd $(GIO_SRC_FSPATH) && $(GIO_BIN) -o $(GIO_BUILD_ANDROID_PATH) -target android .
gio-android-device-start:
	# Blocks in Terminal.
	# start emulator ( .zshrc )
	emulator @testdevice 
gio-android-install:
	# copy apk across to emulator
	cd $(GIO_SRC_FSPATH) && adb install $(GIO_BUILD_ANDROID_PATH)
gio-android-install-del:
	adb uninstall org.gioui.component

@inkeliz
Copy link
Contributor

inkeliz commented Jul 10, 2023

I will take a closer look. However, far I understand, that just compiles, right? Consider the Android, for instance, that compiles the app, and upload it using adb. But, nothing programatically detects if the apps crashes once upload (or opened), or perform any automatic action, right?


All hardware that I use for testing is local. I can create some VMs and VLANs to allow access from GitHub actions (but I don't know if that makes sense at all). Currently, I don't test on Linux/FreeBSD, since my target-audience doesn't use that.

I use SSH to MacOS/Linux and there I compile to iOS/Android, manually. I use a network drive, so every VM (or bare-metal) have access to those files. Then, I run:

android: text
	ssh [email protected] "cd $(dir $(abspath $(firstword $(MAKEFILE_LIST)))) && go mod download gioui.org/cmd && ANDROID_SDK_ROOT=~/android go run gioui.org/cmd/gogio -minsdk 21 -appid com.myapp -version $(version)  -signkey \"../../../codesign/k.pfx\"  -tags \"prod,purego\" -ldflags=\"-s -w\" -arch \"arm64,arm\" -target android -o ../android-arm.apk ."

Similar stuff for MacOS/iOS. Then, I upload using adb to some physical devices that I have (listed on README). I test it manually, which is not perfect. If I notice some bug, then I use adb logcat, or similar. Sometimes I use BrowserStack, which allows to upload .apk and use different devices. In case of iOS I also use Sideloadly (https://sideloadly.io) which allow me to install custom .ipa without need to sign it on MacOS.

@inkeliz
Copy link
Contributor

inkeliz commented Jul 13, 2023

I add support for notarytool on gioui/gio-cmd#11, that is very slow, and should be used only for releases.

@gedw99
Copy link
Author

gedw99 commented Jul 14, 2023

I add support for notarytool on gioui/gio-cmd#11, that is very slow, and should be used only for releases.

nice

@gedw99
Copy link
Author

gedw99 commented Jul 14, 2023

The make file does:

Building for Web, Desktop, Mobile

  • both debug and release

Packaging for Web, Desktop and Mobile.

  • not all targets yet. Mac works.

Installers

  • Desktop: PKG for MAC; MSI for Windows ( not finished yet).

Signing

  • only for Mac so far.

Deploy

  • for IOS and android it has some functions to deploy.
  • For desktop there is none as its not needed

The make file is able to be used in github actions too. So you get the same experience locally and in github actions.


It was developed as a stop gap because the gio cmd was lacking, and i was short on time.

My thinking it to copy anything we like into the gio cmd.


Packaging and installer

Regarding packaging and installer, fyne has golang code to do packaging and installer that gio cmd does not have.

I wanted to standardise it for gio and fyne, but got no uptake, so it's better to just take what parts they have.

https://github.com/fyne-io/fyne/tree/master/cmd/fyne/internal/commands has the bits we need


App Icons

github.com/jackmordaunt/icns/v2 can replace the OS leves calls for MAC and IOS builds in gio cmd.
Here is the Issue i made : JackMordaunt/icns#22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants