Make FHS compliant, split RPMs, fix compilation on older GCCs

This commit is contained in:
Marvin W 2017-04-03 14:10:17 +02:00
parent 22adbd38dc
commit 8248cfcbb2
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
8 changed files with 97 additions and 37 deletions

View File

@ -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})

View File

@ -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
Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%package libs
Summary: Libraries for %{name}
%description devel
The %{name}-devel package contains libraries and header files for
%package libs-devel
Summary: Development files for %{name}
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 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

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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