aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2017-04-03 14:10:17 +0200
committerMarvin W <git@larma.de>2017-04-03 15:05:39 +0200
commit8248cfcbb25dc14c81bd9673c8b3642ce98ea495 (patch)
tree21ec03ad902b001c3e84c428a31e10f62ad18614
parent22adbd38dca0868f0e10754314a3859bba0a7d87 (diff)
downloaddino-8248cfcbb25dc14c81bd9673c8b3642ce98ea495.tar.gz
dino-8248cfcbb25dc14c81bd9673c8b3642ce98ea495.zip
Make FHS compliant, split RPMs, fix compilation on older GCCs
-rw-r--r--CMakeLists.txt2
-rw-r--r--dino.spec89
-rw-r--r--libdino/CMakeLists.txt6
-rw-r--r--libdino/src/plugin/loader.vala25
-rw-r--r--main/src/main.vala6
-rw-r--r--plugins/signal-protocol/CMakeLists.txt2
-rw-r--r--qlite/CMakeLists.txt1
-rw-r--r--xmpp-vala/CMakeLists.txt1
8 files changed, 96 insertions, 36 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bac892fa..449598ec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,7 +36,7 @@ set_path(DESKTOP_FILE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications" "Instal
set_path(ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "Installation directory for icons")
set_path(INCLUDE_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/include" "Installation directory for C header files")
set_path(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/${LIBDIR_NAME}" "Installation directory for object code libraries")
-set_path(PLUGIN_INSTALL_DIR "${DATA_INSTALL_DIR}/plugins" "Installation directory for dino plugin object code files")
+set_path(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/dino/plugins" "Installation directory for dino plugin object code files")
set_path(VAPI_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/vala/vapi" "Installation directory for Vala API files")
set(TARGET_INSTALL LIBRARY DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION ${BIN_INSTALL_DIR} PUBLIC_HEADER DESTINATION ${INCLUDE_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
diff --git a/dino.spec b/dino.spec
index 01284a21..f0865824 100644
--- a/dino.spec
+++ b/dino.spec
@@ -22,9 +22,9 @@
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Name: dino
-Version: 0
-Release: 0%{?dist}
-#Release: 0.git.%{shortcommit}%{?dist}
+Version: 0.0
+Release: 1%{?dist}
+#Release: 1.git.%{shortcommit}%{?dist}
Summary: Modern Jabber/XMPP Client using GTK+/Vala
License: GPLv3
URL: https://github.com/dino/dino
@@ -45,7 +45,11 @@ BuildRequires: pkgconfig(libnotify)
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(openssl)
BuildRequires: gpgme-devel
-Requires: hicolor-icon-theme
+Requires: hicolor-icon-theme
+Requires: %{name}-libs%{?_isa} = %{version}-%{release}
+# Technically these aren't requirements, we just want them always installed...
+Requires: %{name}-plugin-omemo%{?_isa} = %{version}-%{release}
+Requires: %{name}-plugin-openpgp%{?_isa} = %{version}-%{release}
%description
Dino is an instant messaging client for the Jabber/XMPP network,
@@ -56,14 +60,36 @@ for XMPP's latest encryption features. Future versions will provide
a plug-in API, so that developers can easily add new optional
features.
-%package devel
+%package libs
+Summary: Libraries for %{name}
+
+%package libs-devel
Summary: Development files for %{name}
-Requires: %{name}%{?_isa} = %{version}-%{release}
+Requires: %{name}-libs%{?_isa} = %{version}-%{release}
+
+%package plugin-omemo
+Summary: OMEMO plugin for %{name}
+Requires: %{name}-libs%{?_isa} = %{version}-%{release}
+
+%package plugin-openpgp
+Summary: OMEMO plugin for %{name}
+Requires: %{name}-libs%{?_isa} = %{version}-%{release}
-%description devel
-The %{name}-devel package contains libraries and header files for
+%description libs
+The %{name}-libs package contains libraries used and provided by %{name}.
+
+%description libs-devel
+The %{name}-libs-devel package contains libraries and header files for
developing plugins for %{name}.
+%description plugin-omemo
+The %{name}-plugin-omemo package contains a plugin that adds support for
+OMEMO encryption to Dino.
+
+%description plugin-openpgp
+The %{name}-plugin-openpgp package contains a plugin that adds support for
+OpenPGP encryption to Dino.
+
%prep
%setup -n "dino-v%{version}"
#%setup -n "dino-%{commit}"
@@ -85,31 +111,62 @@ update-desktop-database &> /dev/null || :
if [ $1 -eq 0 ] ; then
touch --no-create %{_datadir}/icons/hicolor &>/dev/null
gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor &>/dev/null || :
- glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
fi
%posttrans
gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor &>/dev/null || :
+
+%post libs
+/sbin/ldconfig
+if [ $1 -eq 0 ] ; then
+ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
+fi
+
+%postun libs
+/sbin/ldconfig
+
+%posttrans libs
glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%files
%license LICENSE
%doc README.md
%{_bindir}/dino
-%{_libdir}/libdino.so
-%{_libdir}/libqlite.so
-%{_libdir}/libxmpp-vala.so
-%{_datadir}/dino
%{_datadir}/applications/dino.desktop
-%{_datadir}/glib-2.0/schemas/dino.gschema.xml
%{_datadir}/icons/hicolor/*/apps/dino.*
%{_datadir}/icons/hicolor/*/apps/dino-*
%{_datadir}/icons/hicolor/*/status/dino-*
-%files devel
+%files libs
+%license LICENSE
+%doc README.md
+%{_datadir}/glib-2.0/schemas/dino.gschema.xml
+%{_libdir}/libdino.so.*
+%{_libdir}/libqlite.so.*
+%{_libdir}/libxmpp-vala.so.*
+
+%files libs-devel
+%license LICENSE
+%doc README.md
%{_includedir}/*
+%{_libdir}/libdino.so
+%{_libdir}/libqlite.so
+%{_libdir}/libxmpp-vala.so
%{_datadir}/vala/vapi
+%files plugin-omemo
+%license LICENSE
+%doc README.md
+%{_libdir}/dino/plugins/omemo.so
+
+%files plugin-openpgp
+%license LICENSE
+%doc README.md
+%{_libdir}/dino/plugins/openpgp.so
+
%changelog
-* Fri Mar 24 2017 - 0.0
+* Mon Apr 3 2017 - 0.0-1
+- Split packages
+
+* Fri Mar 24 2017 - 0.0-0
- Initial version
diff --git a/libdino/CMakeLists.txt b/libdino/CMakeLists.txt
index 16454115..517ab945 100644
--- a/libdino/CMakeLists.txt
+++ b/libdino/CMakeLists.txt
@@ -54,11 +54,11 @@ GENERATE_HEADER
dino
)
-add_definitions(${VALA_CFLAGS})
+add_definitions(${VALA_CFLAGS} -DDINO_PLUGINS_SYSTEM_PLUGIN_DIR="${PLUGIN_INSTALL_DIR}" -DDINO_PLUGINS_SYSTEM_LIBDIR_NAME="${LIBDIR_NAME}")
add_library(libdino SHARED ${LIBDINO_VALA_C})
add_dependencies(libdino xmpp-vala-vapi qlite-vapi)
-target_link_libraries(libdino xmpp-vala qlite ${LIBDINO_PACKAGES} -lm)
-set_target_properties(libdino PROPERTIES PREFIX "")
+target_link_libraries(libdino xmpp-vala qlite ${LIBDINO_PACKAGES} m)
+set_target_properties(libdino PROPERTIES PREFIX "" VERSION 0.0 SOVERSION 0)
add_custom_target(dino-vapi
DEPENDS
diff --git a/libdino/src/plugin/loader.vala b/libdino/src/plugin/loader.vala
index 7497311d..d38a0ec5 100644
--- a/libdino/src/plugin/loader.vala
+++ b/libdino/src/plugin/loader.vala
@@ -1,5 +1,8 @@
namespace Dino.Plugins {
+private extern const string SYSTEM_LIBDIR_NAME;
+private extern const string SYSTEM_PLUGIN_DIR;
+
private class Info : Object {
public Module module;
public Type gtype;
@@ -19,30 +22,28 @@ public class Loader : Object {
private Info[] infos = new Info[0];
public Loader(string? exec_str = null) {
- search_paths += Application.get_storage_dir();
+ if (Environment.get_variable("DINO_PLUGIN_DIR") != null) {
+ search_paths += Environment.get_variable("DINO_PLUGIN_DIR");
+ }
+ search_paths += Path.build_filename(Environment.get_home_dir(), ".local", "lib", "dino", "plugins");
string? exec_path = exec_str;
if (exec_path != null) {
if (!exec_path.contains(Path.DIR_SEPARATOR_S)) {
exec_path = Environment.find_program_in_path(exec_str);
}
- // TODO: more robust is detection if installed
- if (!exec_path.has_prefix("/usr/")) {
- search_paths += Path.get_dirname(exec_path);
+ if (Path.get_dirname(exec_path).contains("dino") || Path.get_dirname(exec_path) == "." || Path.get_dirname(exec_path).contains("build")) {
+ search_paths += Path.build_filename(Path.get_dirname(exec_path), "plugins");
}
- }
- foreach (string dir in Environment.get_system_data_dirs()) {
- search_paths += Path.build_filename(dir, "dino");
- }
- if (exec_path != null) {
if (Path.get_basename(Path.get_dirname(exec_path)) == "bin") {
- search_paths += Path.build_filename(Path.get_dirname(Path.get_dirname(exec_path)), "share", "dino");
+ search_paths += Path.build_filename(Path.get_dirname(Path.get_dirname(exec_path)), SYSTEM_LIBDIR_NAME, "dino", "plugins");
}
}
+ search_paths += SYSTEM_PLUGIN_DIR;
}
public void print_search_paths() {
foreach (string prefix in search_paths) {
- print(@"$prefix/plugins\n");
+ print(@"$prefix\n");
}
}
@@ -54,7 +55,7 @@ public class Loader : Object {
Module module = null;
string path = "";
foreach (string prefix in search_paths) {
- path = Path.build_filename(prefix, "plugins", name);
+ path = Path.build_filename(prefix, name);
module = Module.open (path, ModuleFlags.BIND_LAZY);
if (module != null) break;
}
diff --git a/main/src/main.vala b/main/src/main.vala
index 96744e12..14029e47 100644
--- a/main/src/main.vala
+++ b/main/src/main.vala
@@ -16,10 +16,10 @@ void main(string[] args) {
Gtk.init(ref args);
Dino.Ui.Application app = new Dino.Ui.Application();
- app.add_main_option("show-plugin-paths", 0, 0, OptionArg.NONE, "Display plugin search paths and exit", null);
+ app.add_main_option("plugin-paths", 0, 0, OptionArg.NONE, "Display plugin search paths and exit", null);
app.handle_local_options.connect((options) => {
- Variant v = options.lookup_value("show-plugin-paths", VariantType.BOOLEAN);
- if (v != null && v.get_type() == VariantType.BOOLEAN && v.get_boolean()) {
+ Variant v = options.lookup_value("plugin-paths", VariantType.BOOLEAN);
+ if (v != null && v.get_boolean()) {
loader.print_search_paths();
return 0;
}
diff --git a/plugins/signal-protocol/CMakeLists.txt b/plugins/signal-protocol/CMakeLists.txt
index 6a283b9b..2a3c6b07 100644
--- a/plugins/signal-protocol/CMakeLists.txt
+++ b/plugins/signal-protocol/CMakeLists.txt
@@ -34,7 +34,7 @@ set(CFLAGS ${VALA_CFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/libsignal-protocol-c/src
add_definitions(${CFLAGS})
add_library(signal-protocol-vala ${SIGNAL_PROTOCOL_VALA_C} ${CMAKE_CURRENT_SOURCE_DIR}/src/signal_helper.c)
add_dependencies(signal-protocol-vala signal-protocol-c)
-target_link_libraries(signal-protocol-vala ${SIGNAL_PROTOCOL_PACKAGES} ${OPENSSL_CRYPTO_LIBRARY} signal-protocol-c -lm)
+target_link_libraries(signal-protocol-vala ${SIGNAL_PROTOCOL_PACKAGES} ${OPENSSL_CRYPTO_LIBRARY} signal-protocol-c m)
set_property(TARGET signal-protocol-vala PROPERTY POSITION_INDEPENDENT_CODE ON)
set(SIGNAL_PROTOCOL_C_HEADERS
diff --git a/qlite/CMakeLists.txt b/qlite/CMakeLists.txt
index ccc86898..9ffce4ae 100644
--- a/qlite/CMakeLists.txt
+++ b/qlite/CMakeLists.txt
@@ -28,6 +28,7 @@ GENERATE_HEADER
add_definitions(${VALA_CFLAGS})
add_library(qlite SHARED ${QLITE_VALA_C})
target_link_libraries(qlite ${QLITE_PACKAGES})
+set_target_properties(qlite PROPERTIES VERSION 0.1 SOVERSION 0)
add_custom_target(qlite-vapi
DEPENDS
diff --git a/xmpp-vala/CMakeLists.txt b/xmpp-vala/CMakeLists.txt
index 3294b472..7c8ce6e6 100644
--- a/xmpp-vala/CMakeLists.txt
+++ b/xmpp-vala/CMakeLists.txt
@@ -67,6 +67,7 @@ GENERATE_HEADER
add_definitions(${VALA_CFLAGS})
add_library(xmpp-vala SHARED ${ENGINE_VALA_C})
target_link_libraries(xmpp-vala ${ENGINE_PACKAGES})
+set_target_properties(xmpp-vala PROPERTIES VERSION 0.1 SOVERSION 0)
add_custom_target(xmpp-vala-vapi
DEPENDS