Skip to content

Commit

Permalink
fix(gtk): solve dynamic library dependencies and import path on macOS (
Browse files Browse the repository at this point in the history
  • Loading branch information
amirvalhalla authored Jul 25, 2024
1 parent 5057337 commit 89938c4
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .github/releasers/macos/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,10 @@
<string>MIT License.</string>
<key>LSMinimumSystemVersion</key>
<string>10.15</string>
<key>LSEnvironment</key>
<dict>
<key>DYLD_LIBRARY_PATH</key>
<string>@executable_path/../Resources/lib</string>
</dict>
</dict>
</plist>
59 changes: 55 additions & 4 deletions .github/releasers/macos/gui.bundle
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,60 @@
</meta>
<plist>${prefix:bundle}/Info.plist</plist>
<main-binary>${prefix:bundle}/pactus-gui</main-binary>
<resources>
<resource>Resources/*</resource>
</resources>

<binary>
${prefix}/lib/gdk-pixbuf-2.0/${pkg:gdk-pixbuf-2.0:gdk_pixbuf_binary_version}/loaders/*.so
</binary>
<!-- GTK+3 Core Libraries -->
<binary>${prefix:default}/lib/libgtk-3.0.dylib</binary>
<binary>${prefix:default}/lib/libgdk-3.0.dylib</binary>
<binary>${prefix:default}/lib/libgdk_pixbuf-2.0.dylib</binary>
<binary>${prefix:default}/lib/libgdk_pixbuf-2.0.0.dylib</binary>
<binary>${prefix:default}/lib/libcairo.2.dylib</binary>
<binary>${prefix:default}/lib/libcairo.dylib</binary>
<binary>${prefix:default}/lib/libpango-1.0.dylib</binary>
<binary>${prefix:default}/lib/libpango-1.0.0.dylib</binary>
<binary>${prefix:default}/lib/libpangocairo-1.0.dylib</binary>
<binary>${prefix:default}/lib/libpangocairo-1.0.0.dylib</binary>
<binary>${prefix:default}/lib/libcairo-gobject.dylib</binary>
<binary>${prefix:default}/lib/libcairo-gobject.2.dylib</binary>
<binary>${prefix:default}/lib/libpangoft2-1.0.dylib</binary>
<binary>${prefix:default}/lib/libatk-1.0.dylib</binary>
<binary>${prefix:default}/lib/libatk-1.0.0.dylib</binary>
<binary>${prefix:default}/lib/libepoxy.0.dylib</binary>
<binary>${prefix:default}/lib/libepoxy.dylib</binary>

</app-bundle>
<!-- Glib Libraries -->
<binary>${prefix:default}/lib/libgmodule-2.0.0.dylib</binary>
<binary>${prefix:default}/lib/libgmodule-2.0.dylib</binary>
<binary>${prefix:default}/lib/libgobject-2.0.dylib</binary>
<binary>${prefix:default}/lib/libgobject-2.0.0.dylib</binary>
<binary>${prefix:default}/lib/libglib-2.0.dylib</binary>
<binary>${prefix:default}/lib/libglib-2.0.0.dylib</binary>
<binary>${prefix:default}/lib/libgio-2.0.dylib</binary>
<binary>${prefix:default}/lib/libgio-2.0.0.dylib</binary>
<binary>${prefix:default}/lib/libintl.8.dylib</binary>

<!-- Other Dependencies -->
<binary>${prefix:default}/lib/libfontconfig.1.dylib</binary>
<binary>${prefix:default}/lib/libfreetype.6.dylib</binary>
<binary>${prefix:default}/lib/libharfbuzz.0.dylib</binary>
<binary>${prefix:default}/lib/libfribidi.0.dylib</binary>

<!-- Additional Dependencies -->
<binary>${prefix:default}/lib/libpixman-1.dylib</binary>
<binary>${prefix:default}/lib/libpixman-1.0.dylib</binary>
<binary>${prefix:default}/lib/libpng16.16.dylib</binary>
<binary>${prefix:default}/lib/libpng16.dylib</binary>
<binary>${prefix:default}/lib/libxcb-shm.0.dylib</binary>
<binary>${prefix:default}/lib/libxcb-shm.dylib</binary>
<binary>${prefix:default}/lib/libxcb-shm.0.0.0.dylib</binary>
<binary>${prefix:default}/lib/libxcb.1.dylib</binary>
<binary>${prefix:default}/lib/libXrender.1.dylib</binary>
<binary>${prefix:default}/lib/libXrender.dylib</binary>
<binary>${prefix:default}/lib/libX11.6.dylib</binary>
<binary>${prefix:default}/lib/libxcb-render.0.dylib</binary>
<binary>${prefix:default}/lib/libXext.6.dylib</binary>
<binary>${prefix:default}/lib/libXfixes.3.dylib</binary>
<binary>${prefix:default}/lib/libXi.6.dylib</binary>
</app-bundle>
4 changes: 2 additions & 2 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
- uses: actions/checkout@v4

- name: Install Dependencies
run: brew install gtk+3 librsvg create-dmg coreutils pkg-config gdk-pixbuf
run: brew install gtk+3 librsvg create-dmg coreutils pkg-config gdk-pixbuf glib

- name: Install Go
uses: actions/setup-go@v5
Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:
- uses: actions/checkout@v4

- name: Install Dependencies
run: brew install gtk+3 librsvg create-dmg coreutils pkg-config gdk-pixbuf
run: brew install gtk+3 librsvg create-dmg coreutils pkg-config gdk-pixbuf glib

- name: Install Go
uses: actions/setup-go@v5
Expand Down
6 changes: 6 additions & 0 deletions cmd/gtk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"log"
"os"
"path/filepath"
"runtime"

"github.com/gofrs/flock"
"github.com/gotk3/gotk3/gdk"
Expand All @@ -33,6 +34,11 @@ func init() {
passwordOpt = flag.String("password", "", "wallet password")
testnetOpt = flag.Bool("testnet", false, "initializing for the testnet")
version.NodeAgent.AppType = "gui"
// the gtk on macos should run on main thread.
if runtime.GOOS == "darwin" {
runtime.UnlockOSThread()
runtime.LockOSThread()
}
gtk.Init(nil)
}

Expand Down

0 comments on commit 89938c4

Please sign in to comment.