From 721804ab33ab9c0a46e2fa414a1fe6bec8dcc707 Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 21 May 2019 19:46:17 +0200 Subject: [PATCH] Replace the path to the wrapper in remwharead.json. --- CMakeLists.txt | 2 +- .../native-wrapper/CMakeLists.txt | 21 ++++++++++++++++--- .../native-wrapper/replace_nmh_dir.sh | 5 +++++ 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100755 browser-plugins/webextension/native-wrapper/replace_nmh_dir.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index baff763..d21294c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,7 @@ if (WITH_MAN) DEPENDS "${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.1.adoc" COMMAND ${CMAKE_SOURCE_DIR}/build_manpage.sh ARGS ${PROJECT_VERSION}) - add_custom_target(run ALL DEPENDS "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.1") + add_custom_target(man ALL DEPENDS "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.1") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) diff --git a/browser-plugins/webextension/native-wrapper/CMakeLists.txt b/browser-plugins/webextension/native-wrapper/CMakeLists.txt index dd54732..3638188 100644 --- a/browser-plugins/webextension/native-wrapper/CMakeLists.txt +++ b/browser-plugins/webextension/native-wrapper/CMakeLists.txt @@ -1,6 +1,21 @@ -set(MOZILLA_NMH_DIR "${CMAKE_INSTALL_LIBDIR}/mozilla/native-messaging-hosts") +set(MOZILLA_NMH_DIR + "${CMAKE_INSTALL_LIBDIR}/mozilla/native-messaging-hosts") +set(INSTALL_MOZILLA_NMH_DIR + "${CMAKE_INSTALL_PREFIX}/${MOZILLA_NMH_DIR}") add_executable(${PROJECT_NAME}_wrapper ${PROJECT_NAME}_wrapper.cpp) - install(TARGETS ${PROJECT_NAME}_wrapper DESTINATION ${MOZILLA_NMH_DIR}) -install(FILES remwharead.json DESTINATION ${MOZILLA_NMH_DIR}) + +add_custom_command( + OUTPUT "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.json" + WORKING_DIRECTORY + "${CMAKE_SOURCE_DIR}/browser-plugins/webextension/native-wrapper" + DEPENDS "${PROJECT_NAME}.json" + COMMAND "./replace_nmh_dir.sh" + ARGS "${INSTALL_MOZILLA_NMH_DIR}" + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.json") +add_custom_target(nmh_replace ALL + DEPENDS "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.json") +install( + FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.json + DESTINATION ${MOZILLA_NMH_DIR}) diff --git a/browser-plugins/webextension/native-wrapper/replace_nmh_dir.sh b/browser-plugins/webextension/native-wrapper/replace_nmh_dir.sh new file mode 100755 index 0000000..d220b10 --- /dev/null +++ b/browser-plugins/webextension/native-wrapper/replace_nmh_dir.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# Replace directory in remwharead.json + +sed 's|/usr/lib/mozilla/native-messaging-hosts|'"${1}"'|' remwharead.json > "${2}" +