From 285903351b7cf39f1a249028695b53f759c64e1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Pettersson?= Date: Wed, 10 Sep 2014 02:45:12 +0200 Subject: [PATCH] Improved build process and instructions. --- CMakeLists.txt | 16 ++++++++++++++-- README.md | 10 +++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f1016c6..77a4da3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,16 @@ cmake_minimum_required(VERSION 2.8.7) -project(tox-weechat) +project(tox-weechat C) + +option(HOME_FOLDER_INSTALL "Install to ~/.weechat/plugins instead of default location." OFF) +if(HOME_FOLDER_INSTALL) + set(INSTALL_PATH "~/.weechat/plugins") +endif() + +if (NOT DEFINED INSTALL_PATH OR "${INSTALL_PATH}" STREQUAL "") + set(INSTALL_PATH "lib/weechat/plugins") +endif() +set(INSTALL_PATH "${INSTALL_PATH}" CACHE PATH "Path to install the plugin binary to.") add_library(tox MODULE src/tox-weechat.c @@ -11,6 +21,7 @@ add_library(tox MODULE src/tox-weechat-chats.c src/tox-weechat-friend-requests.c ) + add_definitions(-D_GNU_SOURCE) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -Wextra -Werror-implicit-function-declaration -Wno-unused-parameter") @@ -19,4 +30,5 @@ target_link_libraries(tox toxcore) # remove lib prefix (libtox.so -> tox.so) set_target_properties(tox PROPERTIES PREFIX "") -install(TARGETS tox DESTINATION lib/weechat/plugins) +install(TARGETS tox DESTINATION "${INSTALL_PATH}") + diff --git a/README.md b/README.md index f000e65..ee318c4 100644 --- a/README.md +++ b/README.md @@ -6,19 +6,19 @@ Tox-WeeChat is a C plugin for the [WeeChat][1] chat client that enables it to co Installation ------------ -Tox-WeeChat requires [libtoxcore][3] to work. After getting it, install Tox-WeeChat like this: +Tox-WeeChat requires [libtoxcore][3] (and WeeChat) to work. After getting them, install Tox-WeeChat like this: $ git clone https://github.com/haavardp/tox-weechat.git $ cd tox-weechat $ mkdir build && cd build - $ cmake .. - $ make + $ cmake -DHOME_FOLDER_INSTALL=ON .. + $ make install -This builds the plugin binary `tox.so`. Copy/move this file to `~/.weechat/plugins/` (or your equivalent WeeChat home folder) and you're done! +This builds the plugin binary `tox.so` and installs it to `~/.weechat/plugins/`. If your WeeChat home is somewhere else, or you'd like to install the plugin in a different location (e.g. `/usr/local/lib/weechat/plugins`), replace the last command with a simple `make` and manually move `tox.so` to the correct location. Usage ----- -In WeeChat, load the plugin: `/plugin load tox`. You should get a new buffer called tox. This is the core Tox buffer, where output from commands will print. +In WeeChat, load the plugin: `/plugin load tox`. In cases where WeeChat can't find the plugin, try specifying the full path to the binary. You should get a new buffer called tox. This is the core Tox buffer, where output from commands will appear. - To change your name, `/name `. - Get your Tox address with `/myaddress`.