diff --git a/.travis.yml b/.travis.yml index aa6392c..0470bcf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ compiler: before_script: # Installing yasm (needed for compiling vpx) and openal - - sudo apt-get -yq install yasm libopenal-dev + - sudo apt-get -yq install yasm libopenal-dev libconfig-dev libalut-dev # Installing libsodium, needed for toxcore - git clone https://github.com/jedisct1/libsodium.git libsodium - cd libsodium diff --git a/README.md b/README.md index 39485dd..c4e1044 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,16 @@ Toxic is a [Tox](https://tox.im)-based instant messenging client which formerly ##### Base * [libtoxcore](https://github.com/irungentoo/toxcore) * [ncurses](https://www.gnu.org/software/ncurses) (for Debian based systems, 'libncursesw5-dev') +* [libconfig](http://www.hyperrealm.com/libconfig) (for Debian based systems, 'libconfig-dev') ##### Audio * libtoxav (libtoxcore compiled with audio support) * [openal](http://openal.org) +##### Sound notifications +* [openal](http://openal.org) +* [openalut](http://openal.org) + ### Compiling 1. `cd build/` 2. `make PREFIX="/where/to/install"` @@ -24,6 +29,8 @@ Toxic is a [Tox](https://tox.im)-based instant messenging client which formerly * You can pass your own flags to the Makefile with `CFLAGS=""` and/or `LDFLAGS=""` (this will supersede the default ones) * Audio call support is automatically enabled if all dependencies are found * If you want to build toxic without audio call support, you can use `make DISABLE_AV=1` +* Sound notifications support is automatically enabled if all dependencies are found +* If you want to build toxic without sound notifications support, you can use `make DISABLE_NOTIFY=1` ### Packaging * For packaging purpose, you can use `DESTDIR=""` to specify a directory where to store installed files diff --git a/build/Makefile b/build/Makefile index 3a8dce5..42d6304 100644 --- a/build/Makefile +++ b/build/Makefile @@ -6,14 +6,18 @@ CFG_DIR = ../cfg SRC_DIR = ../src MISC_DIR = ../misc DOC_DIR = ../doc +SND_DIR = ../sounds PREFIX = /usr/local BINDIR = $(PREFIX)/bin DATADIR = $(PREFIX)/share/toxic MANDIR = $(PREFIX)/man DATAFILES = DHTnodes toxic.conf.example MANFILES = toxic.1 toxic.conf.5 +SNDFILES = ContactLogsIn.wav ContactLogsOut.wav Error.wav IncomingCall.wav +SNDFILES += LogIn.wav LogOut.wav NewMessage.wav OutgoingCall.wav +SNDFILES += TransferComplete.wav TransferPending.wav -LIBS = libtoxcore ncursesw +LIBS = libtoxcore ncursesw libconfig CFLAGS = -std=gnu99 -pthread -Wall -g CFLAGS += -DTOXICVER="\"$(VERSION)\"" -DHAVE_WIDECHAR -D_XOPEN_SOURCE_EXTENDED @@ -21,15 +25,20 @@ CFLAGS += -DPACKAGE_DATADIR="\"$(abspath $(DATADIR))\"" CFLAGS += $(USER_CFLAGS) LDFLAGS = $(USER_LDFLAGS) -OBJ = chat.o chat_commands.o configdir.o dns.o execute.o file_senders.o +OBJ = chat.o chat_commands.o configdir.o dns.o execute.o file_senders.o notify.o OBJ += friendlist.o global_commands.o groupchat.o line_info.o input.o help.o autocomplete.o OBJ += log.o misc_tools.o prompt.o settings.o toxic.o toxic_strings.o windows.o # Variables for audio support AUDIO_LIBS = libtoxav openal -AUDIO_CFLAGS = -D_SUPPORT_AUDIO +AUDIO_CFLAGS = -D_AUDIO AUDIO_OBJ = device.o audio_call.o +# Variables for sound notify support +SND_NOTIFY_LIBS = openal freealut +SND_NOTIFY_CFLAGS = -D_SOUND_NOTIFY +SND_NOTIFY_OBJ = device.o + # Check on wich system we are running UNAME_S = $(shell uname -s) ifeq ($(UNAME_S), Linux) @@ -57,6 +66,13 @@ ifneq ($(filter arm%, $(UNAME_M)),) -include $(CFG_DIR)/arm.mk endif +# Check if we can use X11 +CHECK_X11_LIBS = $(shell pkg-config x11 || echo -n "error") +ifneq ($(CHECK_X11_LIBS), error) + LIBS += x11 + CFLAGS += -D_X11 +endif + # Check if we want/can build audio ifneq ($(DISABLE_AV), 1) CHECK_AUDIO_LIBS = $(shell pkg-config $(AUDIO_LIBS) || echo -n "error") @@ -74,6 +90,23 @@ endif endif endif +# Check if we want/can build sound notify support +ifneq ($(DISABLE_NOTIFY), 1) +CHECK_NOTIFY_LIBS = $(shell pkg-config $(SND_NOTIFY_LIBS) || echo -n "error") +ifneq ($(CHECK_NOTIFY_LIBS), error) + LIBS += $(SND_NOTIFY_LIBS) + CFLAGS += $(SND_NOTIFY_CFLAGS) + OBJ += $(SND_NOTIFY_OBJ) +else +ifneq ($(MAKECMDGOALS), clean) +MISSING_NOTIFY_LIBS = $(shell for lib in $(SND_NOTIFY_LIBS) ; do if ! pkg-config $$lib ; then echo $$lib ; fi ; done) +$(warning WARNING -- Toxic will be compiled without sound notify support) +$(warning WARNING -- You need these libraries for sound notify support) +$(warning WARNING -- $(MISSING_NOTIFY_LIBS)) +endif +endif +endif + # Check if we can build Toxic CHECK_LIBS = $(shell pkg-config $(LIBS) || echo -n "error") ifneq ($(CHECK_LIBS), error) @@ -99,12 +132,18 @@ toxic: $(OBJ) install: toxic mkdir -p $(abspath $(DESTDIR)/$(BINDIR)) mkdir -p $(abspath $(DESTDIR)/$(DATADIR)) + mkdir -p $(abspath $(DESTDIR)/$(DATADIR))/sounds mkdir -p $(abspath $(DESTDIR)/$(MANDIR)) @echo "Installing toxic executable" @install -m 0755 toxic $(abspath $(DESTDIR)/$(BINDIR)) @echo "Installing data files" @for f in $(DATAFILES) ; do \ install -m 0644 $(MISC_DIR)/$$f $(abspath $(DESTDIR)/$(DATADIR)) ;\ + file=$(abspath $(DESTDIR)/$(DATADIR))/$$f ;\ + sed -i'' -e 's:__DATADIR__:'$(abspath $(DATADIR))':g' $$file ;\ + done + @for f in $(SNDFILES) ; do \ + install -m 0644 $(SND_DIR)/$$f $(abspath $(DESTDIR)/$(DATADIR))/sounds ;\ done @echo "Installing man pages" @for f in $(MANFILES) ; do \ diff --git a/cfg/help.mk b/cfg/help.mk index ea8f18b..80a9bc4 100644 --- a/cfg/help.mk +++ b/cfg/help.mk @@ -8,10 +8,11 @@ help: @echo " help: This help" @echo @echo "-- Variables --" - @echo " DISABLE_AV: Set to \"1\" to force building without audio call support" - @echo " USER_CFLAGS: Add custom flags to default CFLAGS" - @echo " USER_LDFLAGS: Add custom flags to default LDFLAGS" - @echo " PREFIX: Specify a prefix directory for binaries, data files,... (default is \"$(abspath $(PREFIX))\")" - @echo " DESTDIR: Specify a directory where to store installed files (mainly for packaging purpose)" + @echo " DISABLE_AV: Set to \"1\" to force building without audio call support" + @echo " DISABLE_NOTIFY: Set to \"1\" to force building without sound notify support" + @echo " USER_CFLAGS: Add custom flags to default CFLAGS" + @echo " USER_LDFLAGS: Add custom flags to default LDFLAGS" + @echo " PREFIX: Specify a prefix directory for binaries, data files,... (default is \"$(abspath $(PREFIX))\")" + @echo " DESTDIR: Specify a directory where to store installed files (mainly for packaging purpose)" .PHONY: help diff --git a/misc/toxic.conf.example b/misc/toxic.conf.example index 9b6acde..76b1964 100644 --- a/misc/toxic.conf.example +++ b/misc/toxic.conf.example @@ -38,14 +38,14 @@ tox = { }; sounds = { - error="/usr/local/toxic/sounds/Error.wav"; - self_log_in="/usr/local/toxic/sounds/Log In.wav"; - self_log_out="/usr/local/toxic/sounds/Log Out.wav"; - user_log_in="/usr/local/toxic/sounds/Contact Logs In.wav"; - user_log_out="/usr/local/toxic/sounds/Contact Logs Out.wav"; - call_incoming="/usr/local/toxic/sounds/Incoming Call.wav"; - call_outgoing="/usr/local/toxic/sounds/Outgoing Call.wav"; - generic_message="/usr/local/toxic/sounds/New Message.wav"; - transfer_pending="/usr/local/toxic/sounds/Transfer Pending.wav"; - transfer_completed="/usr/local/toxic/sounds/Transfer Complete.wav"; -}; \ No newline at end of file + error="__DATADIR__/sounds/Error.wav"; + self_log_in="__DATADIR__/sounds/LogIn.wav"; + self_log_out="__DATADIR__/sounds/LogOut.wav"; + user_log_in="__DATADIR__/sounds/ContactLogsIn.wav"; + user_log_out="__DATADIR__/sounds/ContactLogsOut.wav"; + call_incoming="__DATADIR__/sounds/IncomingCall.wav"; + call_outgoing="__DATADIR__/sounds/OutgoingCall.wav"; + generic_message="__DATADIR__/sounds/NewMessage.wav"; + transfer_pending="__DATADIR__/sounds/TransferPending.wav"; + transfer_completed="__DATADIR__/sounds/TransferComplete.wav"; +}; diff --git a/sounds/Contact Logs In.wav b/sounds/ContactLogsIn.wav old mode 100755 new mode 100644 similarity index 100% rename from sounds/Contact Logs In.wav rename to sounds/ContactLogsIn.wav diff --git a/sounds/Contact Logs Out.wav b/sounds/ContactLogsOut.wav old mode 100755 new mode 100644 similarity index 100% rename from sounds/Contact Logs Out.wav rename to sounds/ContactLogsOut.wav diff --git a/sounds/Error.wav b/sounds/Error.wav old mode 100755 new mode 100644 diff --git a/sounds/Incoming Call.wav b/sounds/IncomingCall.wav old mode 100755 new mode 100644 similarity index 100% rename from sounds/Incoming Call.wav rename to sounds/IncomingCall.wav diff --git a/sounds/Log In.wav b/sounds/LogIn.wav old mode 100755 new mode 100644 similarity index 100% rename from sounds/Log In.wav rename to sounds/LogIn.wav diff --git a/sounds/Log Out.wav b/sounds/LogOut.wav old mode 100755 new mode 100644 similarity index 100% rename from sounds/Log Out.wav rename to sounds/LogOut.wav diff --git a/sounds/New Message.wav b/sounds/NewMessage.wav old mode 100755 new mode 100644 similarity index 100% rename from sounds/New Message.wav rename to sounds/NewMessage.wav diff --git a/sounds/Outgoing Call.wav b/sounds/OutgoingCall.wav old mode 100755 new mode 100644 similarity index 100% rename from sounds/Outgoing Call.wav rename to sounds/OutgoingCall.wav diff --git a/sounds/Transfer Complete.wav b/sounds/TransferComplete.wav old mode 100755 new mode 100644 similarity index 100% rename from sounds/Transfer Complete.wav rename to sounds/TransferComplete.wav diff --git a/sounds/Transfer Pending.wav b/sounds/TransferPending.wav old mode 100755 new mode 100644 similarity index 100% rename from sounds/Transfer Pending.wav rename to sounds/TransferPending.wav