alexballas / go2tv

Cast media files to UPnP/DLNA Media Renderers and Smart TVs.
MIT License
514 stars 52 forks source link

Bring back macOS functionality #13

Closed gdamjan closed 3 years ago

gdamjan commented 3 years ago

Tried compiling this for my friends x86 MacBook with make GOOS=darwin GOARCH=amd64 but it failed on go-gl.

Maybe the GUI can be made optional for macOS?

$ make GOOS=darwin GOARCH=amd64
rm -rf ./build
go build -ldflags "-s -w -X main.build=`date -u +%Y%m%d%H%M%S` -X main.version=`cat ./version.txt` " -o build/go2tv cmd/go2tv/go2tv.go cmd/go2tv/flagfuncs.go
package command-line-arguments
        imports github.com/alexballas/go2tv/internal/gui
        imports fyne.io/fyne/v2/app
        imports fyne.io/fyne/v2/internal/driver/glfw
        imports fyne.io/fyne/v2/internal/painter/gl
        imports github.com/go-gl/gl/v3.2-core/gl: build constraints exclude all Go files in /home/damjan/go/pkg/mod/github.com/go-gl/gl@v0.0.0-20190320180904-bf2b1f2f34d7/v3.2-core/gl
make: *** [Makefile:4: build] Error 1
alexballas commented 3 years ago

Hello, I'll prepare some build instructions on how to build it for Mac from Linux, later today

alexballas commented 3 years ago

You can use https://github.com/fyne-io/fyne-cross#build-the-docker-image-for-osxdarwinapple-cross-compiling to build for Mac

To sum up

Requirements

Steps: 1) Run go get github.com/fyne-io/fyne-cross 2) Make sure that the go path is correctly exported, if not export PATH=$PATH:$(go env GOPATH)/bin 3) Download Command Line Tools for Xcode >= 12.4 (macOS SDK 11.x) from here https://developer.apple.com/download/more 4) Run: fyne-cross darwin-image --xcode-path /path/to/Command_Line_Tools_for_Xcode_12.5.dmg. This will prepare a docker image. (it takes a while) 5) Git pull Go2TV git clone https://github.com/alexballas/go2tv.git and cd go2tv 6) Run fyne-cross darwin -icon assets/go2tv-icon.png -app-id "go2tv" cmd/go2tv/go2tv.go. This will build you an .app file which should work fine on Mac.

Optionally if you want to convert the .app file to DMG you could try something like that https://askubuntu.com/questions/1117461/how-do-i-create-a-dmg-file-on-linux-ubuntu-for-macos

Since I don't personally own a Mac, I have not tested the generated file to one. Let me know if you need help building it.

gdamjan commented 3 years ago

Thanks for this. I'll have to see if it's easier to try this approach, or just compile it on my friends Mac itself (if they have xcode even).

alexballas commented 3 years ago

Thanks. One thing to keep in mind is that after the "Catalina" version, Apple made it even harder to open applications that were not signed with their notarization process. Distributing Mac software requires the usage of a Mac device. On top of that, notarizing the application requires you to be enrolled in the Apple Developer Program for $99/year. These are practically the reasons why I'm not distributing any Mac builds (yet)

I'll keep this ticket open to properly document the build process.

alexballas commented 3 years ago

Resolving. Please refer to the latest release binaries