Open Aurora12 opened 4 years ago
In addition, shouldn't the following work?
$ hover build darwin-dmg
hover: Packaging darwin-bundle is not supported on darwin
hover: To still package darwin-bundle on darwin you need to run hover with the `--docker` flag.
$ hover build darwin-bundle
hover: Packaging darwin-bundle is not supported on darwin
hover: To still package darwin-bundle on darwin you need to run hover with the `--docker` flag.
$ hover build darwin-pkg
hover: Packaging darwin-bundle is not supported on darwin
hover: To still package darwin-bundle on darwin you need to run hover with the `--docker` flag.
There is no support currently, because I don't have a Mac and working in a VM is a pain. If you want you can add support. It should be fairly easy
I ended up packaging with a series of commands to Xcode command-line tools.
What I added:
./osx/bundle/ # becomes the root folder of .app
/Contents/
/Frameworks # bundled dlls
/MacOS # build files generated by `hover build darwin` command
/Resources # icons and such
Info.plist # main package descriptor
./osx/hardened_runtime_entitlements.plist # the list of entitlements used by codesign tool
2. two `.plist` declarations: one for the `.app` and another for signing with entitlements for [hardened runtime](https://wiki.lazarus.freepascal.org/Hardened_runtime_for_macOS).
3. a bash script that copies the build files and the template folder around, packs and signs them.
These are the steps the build script takes:
1. Copy the template folder from `./osx/bundle` to `./go/build/outputs/osx-package/YourAppPackage/YourApp.app`
2. Copy the build files from `./go/build/outputs/darwin` to `osx-package/YourAppPackage/YourApp.app/Contents/MacOS`
3. If you have any dlls (dylibs) bundled, use `install_name_tool` to change the target of dll loader so it points to the bundled library files instead of the system ones.
4. Use `codesign` tool to sign the YourApp.app folder with the `Developer ID Application` certificate that should be present on the local keychain. The important options to use are: `--options=runtime`, `--timestamp` and `--entitlements ./osx/hardened_runtime_entitlements.plist` to be able to [notarise the app with Apple](https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow).
5. Use `hdiutil` tool to create a `.dmg` image file from the `YourAppPackage` folder.
6. Use `codesign` tool again to sign the `.dmg` package with the same certificate as previously.
7. Use `altool` to [notarise the app with Apple](https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow). This requires an [app-specific password](https://support.apple.com/en-us/HT204397) to be present on the keychain with `AC_PASSWORD` as the name of keychain item. You can still use the `.dmg` package without this, but you will have to go to the system security preferences and allow it to run.
Hover doctor
Preamble
The following does work.
I use CGo to compile xeodou/go-sqlcipher.
I use a modified version of
go-flutter-plugin-sqlite
to be able to usego-sqlcipher
for transparent database encryption over SQLite.~/go/bin/hover run
and~/go/bin/hover build darwin
work as expected: the Flutter app runs and uses encrypted SQLite. I have env varsCGO_ENABLED
,LIBRARY_PATH
andCGO_CPPFLAGS
set appropriately to make the compilation possible.I also have OpenSSL installed as a dependency of SQLCipher.
Error output
I'm not able to package the app on macOS Catalina 10.15.5.
Using
~/go/bin/hover build --docker darwin-dmg
to build my application, I get the following error once the compilation reachesgo-sqlcipher
:Attempts to fix
I figured the compiler may not know we are using CGo, so I set
ENV CGO_ENABLED=1
in Hover's DockerFile to see if this changes the error. I also figured, this may be a problem with the version of GCC, so I tried building the Hover docker image withgcc:latest
as a parent image instead of originalubuntu:bionic
.Nothing I did made any difference: the error remains the same, the compiler refuses the
sqlite3-binding.c
syntax. I can see Hover is using my local docker image by the way it complains on theCGO_CPPFLAGS
.Any ideas?
Any hints or directions are greatly appreciated!