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

Use pkg-config to get dependencies #14

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Build-Scripts/gen-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering that Apple has basically stopped supporting bash on macOS either pure sh or at least zsh would be a better idea.


HOMEBREW_BIN="${HOMEBREW_ROOT:-/opt/homebrew}/bin"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does modern homebrew installation set this variable? Mine (a few years old) definitely didn't.

Anyway why not use brew config | grep "HOMEBREW_PREFIX:" | awk -F ' ' '{print $2}' or something similar to find it when env var is not set?

if [ -d "$HOMEBREW_BIN" ] ; then
PATH="$HOMEBREW_BIN:$PATH"
export PATH
else
echo "warning: $HOMEBREW_BIN doesn't exist. This build will likely fail."
echo "warning: If homebrew is installed elsewhere, set the HOMEBREW_ROOT environment variable."
fi

PACKAGES="pidgin gtk-mac-integration-gtk2"
PIDGIN_PATH="$(pkg-config pidgin --variable=prefix)/bin/pidgin"
OTHER_CFLAGS="$(pkg-config $PACKAGES --cflags-only-other)"
OTHER_LDFLAGS="$(pkg-config $PACKAGES --libs-only-l) -bundle_loader ${PIDGIN_PATH}"
HEADER_SEARCH_PATHS="$(pkg-config $PACKAGES --cflags-only-I | sed 's/^-I//g;s/ -I/ /g')"
LIBRARY_SEARCH_PATHS="$(pkg-config $PACKAGES --libs-only-L | sed 's/^-L//g;s/ -L/ /g')"

cat <<EOF > "${PROJECT_DIR}/Dependencies.xcconfig"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it should write to a file that is a part of the repository. That generated file should be in gitignore otherwise it makes fictional changes.

// With Homebrew path = ${HOMEBREW_BIN}
OTHER_CFLAGS = \$(inherited) ${OTHER_CFLAGS}
OTHER_LDFLAGS = \$(inherited) ${OTHER_LDFLAGS}
HEADER_SEARCH_PATHS = \$(inherited) ${HEADER_SEARCH_PATHS}
LIBRARY_SEARCH_PATHS = \$(inherited) ${LIBRARY_SEARCH_PATHS}
EOF

Empty file added Dependencies.xcconfig
Empty file.
16 changes: 7 additions & 9 deletions PidginMacOSIntegration-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
#import <gtk/gtk.h>

// Pidgin
#import <pidgin/gtkblist.h>
#import <pidgin/gtknotify.h>
#import <pidgin/gtkconv.h>
#import <pidgin/gtkdialogs.h>
#import <pidgin/gtkimhtml.h>
#import <pidgin/gtkplugin.h>
#import <pidgin/gtkutils.h>
#import <gtkblist.h>
#import <gtknotify.h>
#import <gtkconv.h>
#import <gtkdialogs.h>
#import <gtkimhtml.h>
#import <gtkplugin.h>
#import <gtkutils.h>

// Purple
#import <notify.h>
Expand All @@ -28,6 +28,4 @@
#import "PluginLoad.h"
#import "Log.h"
#import "Menu.h"
#import "GtkTree.h"
#import "GtkWindow.h"
#import "PidginImage.h"
154 changes: 14 additions & 140 deletions PidginMacOSIntegration.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
9DFC539927488134005F0927 /* Dependencies.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Dependencies.xcconfig; sourceTree = "<group>"; };
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some kind of a Run Script phase or similar config is missing - currently it doesn't run the script at all and that would be the expected behavior (and commits mention it).

After manually running the script with correct env vars (I can only hope that xcode sets correct project dir as of now) it builds correctly through both XCode and terminal command.

DF0215C824D1F2A100B1437C /* Menu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Menu.swift; sourceTree = "<group>"; };
DF05113E212621A000B993BA /* PluginLoad.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PluginLoad.h; sourceTree = "<group>"; };
DF32486824CF59CE003E4F23 /* Log.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Log.m; sourceTree = "<group>"; };
Expand All @@ -50,27 +51,6 @@
DF496AEA211E76020059EE2C /* Main.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Main.h; sourceTree = "<group>"; };
DF496AEB211E76020059EE2C /* Main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = Main.c; sourceTree = "<group>"; };
DFAB7D9824D0B24600BED1F9 /* Callback.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Callback.swift; sourceTree = "<group>"; };
DFD69E6F2126633300532B79 /* sendbutton.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = sendbutton.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/sendbutton.so; sourceTree = "<group>"; };
DFD69E702126633300532B79 /* history.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = history.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/history.so; sourceTree = "<group>"; };
DFD69E712126633300532B79 /* relnot.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = relnot.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/relnot.so; sourceTree = "<group>"; };
DFD69E722126633300532B79 /* themeedit.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = themeedit.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/themeedit.so; sourceTree = "<group>"; };
DFD69E732126633300532B79 /* notify.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = notify.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/notify.so; sourceTree = "<group>"; };
DFD69E742126633300532B79 /* convcolors.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = convcolors.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/convcolors.so; sourceTree = "<group>"; };
DFD69E752126633300532B79 /* markerline.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = markerline.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/markerline.so; sourceTree = "<group>"; };
DFD69E762126633300532B79 /* gtkbuddynote.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = gtkbuddynote.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/gtkbuddynote.so; sourceTree = "<group>"; };
DFD69E772126633300532B79 /* timestamp_format.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = timestamp_format.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/timestamp_format.so; sourceTree = "<group>"; };
DFD69E782126633300532B79 /* xmppdisco.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = xmppdisco.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/xmppdisco.so; sourceTree = "<group>"; };
DFD69E792126633300532B79 /* iconaway.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = iconaway.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/iconaway.so; sourceTree = "<group>"; };
DFD69E7A2126633300532B79 /* extplacement.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = extplacement.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/extplacement.so; sourceTree = "<group>"; };
DFD69E7B2126633300532B79 /* spellchk.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = spellchk.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/spellchk.so; sourceTree = "<group>"; };
DFD69E7C2126633300532B79 /* ticker.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = ticker.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/ticker.so; sourceTree = "<group>"; };
DFD69E7D2126633300532B79 /* pidginrc.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = pidginrc.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/pidginrc.so; sourceTree = "<group>"; };
DFD69E7E2126633300532B79 /* timestamp.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = timestamp.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/timestamp.so; sourceTree = "<group>"; };
DFD69E7F2126633300532B79 /* transparency.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = transparency.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/transparency.so; sourceTree = "<group>"; };
DFD69E802126633300532B79 /* pidgin-otr.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = "pidgin-otr.so"; path = "../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/pidgin-otr.so"; sourceTree = "<group>"; };
DFD69E812126633300532B79 /* xmppconsole.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = xmppconsole.so; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib/pidgin/xmppconsole.so; sourceTree = "<group>"; };
DFD69E95212663A100532B79 /* lib */ = {isa = PBXFileReference; lastKnownFileType = folder; name = lib; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/lib; sourceTree = "<group>"; };
DFD69E972126699A00532B79 /* pidgin */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = pidgin; path = ../../../../../usr/local/Cellar/pidgin/2.13.0_2/bin/pidgin; sourceTree = "<group>"; };
DFE300C1211E5B89000E188E /* PidginMacOSIntegration */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = PidginMacOSIntegration; sourceTree = BUILT_PRODUCTS_DIR; };
DFE300C4211E5B89000E188E /* Plugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Plugin.swift; sourceTree = "<group>"; };
DFE300CB211E5BFC000E188E /* PidginMacOSIntegration-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "PidginMacOSIntegration-Bridging-Header.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -124,34 +104,14 @@
DFD69E6E2126633300532B79 /* Frameworks */ = {
isa = PBXGroup;
children = (
DFD69E972126699A00532B79 /* pidgin */,
DFD69E95212663A100532B79 /* lib */,
DFD69E742126633300532B79 /* convcolors.so */,
DFD69E7A2126633300532B79 /* extplacement.so */,
DFD69E762126633300532B79 /* gtkbuddynote.so */,
DFD69E702126633300532B79 /* history.so */,
DFD69E792126633300532B79 /* iconaway.so */,
DFD69E752126633300532B79 /* markerline.so */,
DFD69E732126633300532B79 /* notify.so */,
DFD69E802126633300532B79 /* pidgin-otr.so */,
DFD69E7D2126633300532B79 /* pidginrc.so */,
DFD69E712126633300532B79 /* relnot.so */,
DFD69E6F2126633300532B79 /* sendbutton.so */,
DFD69E7B2126633300532B79 /* spellchk.so */,
DFD69E722126633300532B79 /* themeedit.so */,
DFD69E7C2126633300532B79 /* ticker.so */,
DFD69E772126633300532B79 /* timestamp_format.so */,
DFD69E7E2126633300532B79 /* timestamp.so */,
DFD69E7F2126633300532B79 /* transparency.so */,
DFD69E812126633300532B79 /* xmppconsole.so */,
DFD69E782126633300532B79 /* xmppdisco.so */,
);
name = Frameworks;
sourceTree = "<group>";
};
DFE300B8211E5B89000E188E = {
isa = PBXGroup;
children = (
9DFC539927488134005F0927 /* Dependencies.xcconfig */,
DFE300C3211E5B89000E188E /* PidginMacOSItegration */,
DFE300C2211E5B89000E188E /* Products */,
DFE300CB211E5BFC000E188E /* PidginMacOSIntegration-Bridging-Header.h */,
Expand Down Expand Up @@ -384,7 +344,9 @@
};
DFE300C9211E5B89000E188E /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9DFC539927488134005F0927 /* Dependencies.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
GCC_PREPROCESSOR_DEFINITIONS = (
Expand All @@ -394,73 +356,30 @@
"PACKAGE=\\\"pidgin\\\"",
"PACKAGE_NAME=\\\"pidgin\\\"",
);
HEADER_SEARCH_PATHS = "";
HEADER_SEARCH_PATHS = "$(inherited)";
LD_DYLIB_INSTALL_NAME = pidgin_macos_integration;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"/usr/local/opt/pidgin/lib/**",
/usr/local/opt/glib/lib/,
"/usr/local/opt/gtk-mac-integration/lib/",
"/usr/local/opt/gtk+/lib/",
"/usr/local/opt/cairo/lib/**",
"/usr/local/opt/pango/lib/**",
"/usr/local/opt/gdk-pixbuf/lib/**",
"/usr/local/opt/atk/lib/**",
/usr/local/opt/pidgin/bin,
/usr/local/opt/gettext/lib,
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
MACH_O_TYPE = mh_bundle;
MACOSX_DEPLOYMENT_TARGET = 10.14;
OTHER_LDFLAGS = (
"-lglib-2.0",
"-lpurple",
"-lgobject-2.0",
"-lgtkmacintegration-gtk2",
"-lcairo-gobject",
"-lgtkmacintegration-gtk2",
"-lgtk-quartz-2.0",
"-lgdk-quartz-2.0",
"-lpangocairo-1.0",
"-lpango-1.0",
"-latk-1.0",
"-lcairo",
"-lgdk_pixbuf-2.0",
"-lgio-2.0",
"-lgobject-2.0",
"-lintl",
"-lglib-2.0",
"-bundle_loader",
/usr/local/bin/pidgin,
);
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_NAME = "${TARGET_NAME}";
SWIFT_OBJC_BRIDGING_HEADER = "PidginMacOSIntegration-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
SYSTEM_HEADER_SEARCH_PATHS = (
"/usr/local/opt/glib/include/**",
"/usr/local/opt/glib/lib/glib-2.0/include/",
"/usr/local/opt/gtk-mac-integration/include/**",
"/usr/local/opt/gtk+/include/**",
"/usr/local/opt/gtk+/lib/gtk-2.0/include/**",
"/usr/local/opt/cairo/include/**",
"/usr/local/opt/pango/include/**",
"/usr/local/opt/gdk-pixbuf/include/**",
"/usr/local/opt/atk/include/**",
"/usr/local/opt/pidgin/include/**",
/usr/local/opt/gettext/include,
/usr/local/opt/pidgin/include/libpurple/,
"/usr/local/opt/harfbuzz/include/**",
);
SYSTEM_HEADER_SEARCH_PATHS = "";
};
name = Debug;
};
DFE300CA211E5B89000E188E /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9DFC539927488134005F0927 /* Dependencies.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
GCC_PREPROCESSOR_DEFINITIONS = (
Expand All @@ -470,67 +389,22 @@
"PACKAGE=\\\"pidgin\\\"",
"PACKAGE_NAME=\\\"pidgin\\\"",
);
HEADER_SEARCH_PATHS = "";
HEADER_SEARCH_PATHS = "$(inherited)";
LD_DYLIB_INSTALL_NAME = pidgin_macos_integration;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"/usr/local/opt/pidgin/lib/**",
/usr/local/opt/glib/lib/,
"/usr/local/opt/gtk-mac-integration/lib/",
"/usr/local/opt/gtk+/lib/",
"/usr/local/opt/cairo/lib/**",
"/usr/local/opt/pango/lib/**",
"/usr/local/opt/gdk-pixbuf/lib/**",
"/usr/local/opt/atk/lib/**",
/usr/local/opt/pidgin/bin,
/usr/local/opt/gettext/lib,
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
MACH_O_TYPE = mh_bundle;
MACOSX_DEPLOYMENT_TARGET = 10.14;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"-lglib-2.0",
"-lpurple",
"-lgobject-2.0",
"-lgtkmacintegration-gtk2",
"-lcairo-gobject",
"-lgtkmacintegration-gtk2",
"-lgtk-quartz-2.0",
"-lgdk-quartz-2.0",
"-lpangocairo-1.0",
"-lpango-1.0",
"-latk-1.0",
"-lcairo",
"-lgdk_pixbuf-2.0",
"-lgio-2.0",
"-lgobject-2.0",
"-lintl",
"-lglib-2.0",
"-bundle_loader",
/usr/local/bin/pidgin,
);
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_NAME = "${TARGET_NAME}";
SWIFT_OBJC_BRIDGING_HEADER = "PidginMacOSIntegration-Bridging-Header.h";
SWIFT_VERSION = 5.0;
SYSTEM_HEADER_SEARCH_PATHS = (
"/usr/local/opt/glib/include/**",
"/usr/local/opt/glib/lib/glib-2.0/include/",
"/usr/local/opt/gtk-mac-integration/include/**",
"/usr/local/opt/gtk+/include/**",
"/usr/local/opt/gtk+/lib/gtk-2.0/include/**",
"/usr/local/opt/cairo/include/**",
"/usr/local/opt/pango/include/**",
"/usr/local/opt/gdk-pixbuf/include/**",
"/usr/local/opt/atk/include/**",
"/usr/local/opt/pidgin/include/**",
/usr/local/opt/gettext/include,
/usr/local/opt/pidgin/include/libpurple/,
"/usr/local/opt/harfbuzz/include/**",
);
SYSTEM_HEADER_SEARCH_PATHS = "";
};
name = Release;
};
Expand Down