From ae97f07a41e75a73b7ac3e1d218e2dae79b282db Mon Sep 17 00:00:00 2001 From: Chris Josten Date: Tue, 2 Mar 2021 01:31:17 +0100 Subject: [PATCH] Move to Meson build system --- ober/.gitignore | 15 +++++++++++ ober/dub.json | 32 ++++++++++++---------- ober/dub.json.old | 15 +++++++++++ ober/dub.selections.json | 14 ---------- ober/meson.build | 39 +++++++++++++++++++++++++++ ober/source/app.d | 14 ++++++++-- ober/source/msgpackrpc/client.d | 2 +- ober/source/msgpackrpc/package.d | 4 +-- ober/subprojects/ddbus.wrap | 6 +++++ ober/subprojects/eventcore.wrap | 6 +++++ ober/subprojects/msgpack.wrap | 6 +++++ ober/subprojects/taggedalgebraic.wrap | 6 +++++ ober/subprojects/vibe-core.wrap | 6 +++++ 13 files changed, 132 insertions(+), 33 deletions(-) create mode 100644 ober/.gitignore create mode 100644 ober/dub.json.old delete mode 100644 ober/dub.selections.json create mode 100644 ober/meson.build create mode 100644 ober/subprojects/ddbus.wrap create mode 100644 ober/subprojects/eventcore.wrap create mode 100644 ober/subprojects/msgpack.wrap create mode 100644 ober/subprojects/taggedalgebraic.wrap create mode 100644 ober/subprojects/vibe-core.wrap diff --git a/ober/.gitignore b/ober/.gitignore new file mode 100644 index 0000000..6964ce9 --- /dev/null +++ b/ober/.gitignore @@ -0,0 +1,15 @@ +.dub +docs.json +__dummy.html +docs/ +/aiuo-shutdown +aiuo-shutdown.so +aiuo-shutdown.dylib +aiuo-shutdown.dll +aiuo-shutdown.a +aiuo-shutdown.lib +aiuo-shutdown-test-* +*.exe +*.o +*.obj +*.lst diff --git a/ober/dub.json b/ober/dub.json index 990bdda..5e9f9e2 100644 --- a/ober/dub.json +++ b/ober/dub.json @@ -1,15 +1,19 @@ { - "authors": [ - "Chris Josten" - ], - "copyright": "Copyright © 2021, Chris Josten", - "dependencies": { - "ddbus": {"path": "/home/chris/Programmeren/D/ddbus"}, - "msgpack-d": "~>1.0.3", - "vibe-core": "~>1.13.0" - }, - "description": "Automatisch In-Uitschakelen Ober", - "license": "MIT", - "name": "aiuo-shutdown", - "versions": ["WithRPC"] -} + "name": "mvoau ober", + "authors": "Meson Team", + "copyright": "Copyright © 2018, Meson Team", + "license": [ + "MIT" + ], + "sourceFiles": [ + "source/msgpackrpc/client.d", + "source/msgpackrpc/package.d", + "source/msgpackrpc/protocol.d", + "source/msgpackrpc/server.d", + "source/app.d" + ], + "targetType": "executable", + "dependencies": { + "ddbus": "3.0.0" + } +} \ No newline at end of file diff --git a/ober/dub.json.old b/ober/dub.json.old new file mode 100644 index 0000000..7569cf2 --- /dev/null +++ b/ober/dub.json.old @@ -0,0 +1,15 @@ +{ + "authors": [ + "Chris Josten" + ], + "copyright": "Copyright © 2021, Chris Josten", + "dependencies": { + "ddbus": {"path": "/home/chris/Programmeren/D/ddbus"}, + "msgpack-d": "~>1.0.3", + "vibe-core": "~>1.13.0" + }, + "description": "Automatisch In-Uitschakelen Ober", + "license": "MIT", + "name": "aiuo-shutdown", + "versions": [] +} diff --git a/ober/dub.selections.json b/ober/dub.selections.json deleted file mode 100644 index 299396f..0000000 --- a/ober/dub.selections.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "ddbus": {"path":"../../../D/ddbus"}, - "dunit": "1.0.16", - "eventcore": "0.9.13", - "libasync": "0.8.6", - "memutils": "1.0.4", - "msgpack-d": "1.0.3", - "stdx-allocator": "2.77.5", - "taggedalgebraic": "0.11.19", - "vibe-core": "1.13.0" - } -} diff --git a/ober/meson.build b/ober/meson.build new file mode 100644 index 0000000..2439bfa --- /dev/null +++ b/ober/meson.build @@ -0,0 +1,39 @@ +project( + 'MVOAU Ober', 'd', + version: '1.0.0', + license: 'MIT', + meson_version: '>= 0.52' +) + +mvoau_ober_src_dir = include_directories('source/') +mvoau_ober_src = [ + 'source/msgpackrpc/client.d', + 'source/msgpackrpc/package.d', + 'source/msgpackrpc/protocol.d', + 'source/msgpackrpc/server.d', + 'source/app.d' +] + +ddbus_dep = dependency('ddbus', version: '3.0.0') +msgpack_d_dep = dependency('msgpack-d', version: '>=1.0.0') +vibe_core_dep = dependency('vibe-core', version: '>=1.13') + +mvoau_ober_deps = [ddbus_dep, msgpack_d_dep, vibe_core_dep] + +executable('mvoau', + mvoau_ober_src, + include_directories: mvoau_ober_src_dir, + dependencies: [ddbus_dep, + msgpack_d_dep, + vibe_core_dep], + install: true) + +dlang = import('dlang') +dlang.generate_dub_file(meson.project_name().to_lower(), meson.source_root(), + authors: 'Meson Team', + copyright: 'Copyright © 2018, Meson Team', + license: meson.project_license(), + sourceFiles: mvoau_ober_src, + targetType: 'executable', + dependencies: mvoau_ober_deps +) diff --git a/ober/source/app.d b/ober/source/app.d index db621bf..8649b47 100644 --- a/ober/source/app.d +++ b/ober/source/app.d @@ -78,6 +78,14 @@ public: } } + MessageRouter testRouter = new MessageRouter(); + MessagePattern desktopChangePattern = MessagePattern(ObjectPath("/VirtualDesktopManager"), interfaceName("org.kde.KWin.VirtualDesktopManager"), "currentChanged", true); + dbus_bus_add_match(m_dbusCon.conn, "type='signal',sender='org.kde.KWin',interface='org.kde.KWin.VirtualDesktopManager,path='/VirtualDesktopManager',member='currentChanged'", null); + testRouter.setHandler!(void, string)(desktopChangePattern, (string id) { + logf("Desktop changed: %s", id); + }); + registerRouter(m_dbusCon, testRouter); + version(WithRPC) { // Register signal listeners // FIXME: this does not work yet. @@ -121,8 +129,10 @@ public: scope (exit) { // Als we om een of andere redenen deze functie verlaten, laat het slot los! releaseLock(inhibitLock); - releaseLock(sleepLock); - releaseLock(shutdownLock); + version(WithRPC) { + releaseLock(sleepLock); + releaseLock(shutdownLock); + } } int checkCount = CHECK_COUNT; diff --git a/ober/source/msgpackrpc/client.d b/ober/source/msgpackrpc/client.d index d8fc470..dcaf1db 100644 --- a/ober/source/msgpackrpc/client.d +++ b/ober/source/msgpackrpc/client.d @@ -14,7 +14,7 @@ import vibe.core.core; import vibe.core.net; import vibe.core.task; -import protocol; +import msgpackrpc.protocol; /** * MessagePack RPC client diff --git a/ober/source/msgpackrpc/package.d b/ober/source/msgpackrpc/package.d index d51a182..9ce42e8 100644 --- a/ober/source/msgpackrpc/package.d +++ b/ober/source/msgpackrpc/package.d @@ -1,3 +1,3 @@ module msgpackrpc; -public import client; -public import server; +public import msgpackrpc.client; +public import msgpackrpc.server; diff --git a/ober/subprojects/ddbus.wrap b/ober/subprojects/ddbus.wrap new file mode 100644 index 0000000..32401d2 --- /dev/null +++ b/ober/subprojects/ddbus.wrap @@ -0,0 +1,6 @@ +[wrap-git] +url = https://github.com/HenkKalkwater/ddbus.git +revision = e4ff08ba9ddcbfde972de86fc9e71c1aeb7b289c + +[provide] +dependency_names = ddbus-3.0.0 diff --git a/ober/subprojects/eventcore.wrap b/ober/subprojects/eventcore.wrap new file mode 100644 index 0000000..99a6b29 --- /dev/null +++ b/ober/subprojects/eventcore.wrap @@ -0,0 +1,6 @@ +[wrap-git] +url = https://github.com/HenkKalkwater/eventcore.git +revision = 17ade7f9cacfa0fe8d38cc64b22276de4884a620 + +[provide] +eventcore = eventcore_dep diff --git a/ober/subprojects/msgpack.wrap b/ober/subprojects/msgpack.wrap new file mode 100644 index 0000000..b9bcf93 --- /dev/null +++ b/ober/subprojects/msgpack.wrap @@ -0,0 +1,6 @@ +[wrap-git] +url = https://github.com/msgpack/msgpack-d.git +revision = v1.0.3 + +[provide] +msgpack-d = msgpack_dep diff --git a/ober/subprojects/taggedalgebraic.wrap b/ober/subprojects/taggedalgebraic.wrap new file mode 100644 index 0000000..6fb5bb1 --- /dev/null +++ b/ober/subprojects/taggedalgebraic.wrap @@ -0,0 +1,6 @@ +[wrap-git] +url = https://github.com/HenkKalkwater/taggedalgebraic.git +revision = 466b9ab32e0a76f0f5cf65afbfc9edd939966b22 + +[provide] +taggedalgebraic = taggedalgebraic_dep diff --git a/ober/subprojects/vibe-core.wrap b/ober/subprojects/vibe-core.wrap new file mode 100644 index 0000000..17e62c0 --- /dev/null +++ b/ober/subprojects/vibe-core.wrap @@ -0,0 +1,6 @@ +[wrap-git] +url = https://github.com/HenkKalkwater/vibe-core.git +revision = cca1063f88f184b40443863e463695c559e8ef7e + +[provide] +vibe-core = vibe_core_dep