mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 10:13:03 +01:00
Make Toxic easier to port
This commit is contained in:
parent
e7c5fbc873
commit
f90a774470
@ -38,8 +38,8 @@ You can omit `libnotify` if you intend to build without desktop notifications en
|
||||
|
||||
## Compiling
|
||||
```
|
||||
make PREFIX="/where/to/install"
|
||||
sudo make install PREFIX="/where/to/install"
|
||||
make
|
||||
sudo env PREFIX="/where/to/install" make install
|
||||
```
|
||||
|
||||
#### Documentation
|
||||
@ -50,8 +50,8 @@ Run `make doc` in the build directory after editing the asciidoc files to regene
|
||||
## Notes
|
||||
|
||||
#### Compilation variables
|
||||
* You can add specific flags to the Makefile with `USER_CFLAGS=""` and/or `USER_LDFLAGS=""`
|
||||
* You can pass your own flags to the Makefile with `CFLAGS=""` and/or `LDFLAGS=""` (this will supersede the default ones)
|
||||
* You can add specific flags to the Makefile with `USER_CFLAGS=""` and `USER_LDFLAGS=""` passed as the arguments to make or as environment variables
|
||||
* You can use CFLAGS and LDFLAGS environment variables to add specific flags to the Makefile
|
||||
* Additional features are automatically enabled if all dependencies are found, but you can disable them by using special variables:
|
||||
* `DISABLE_X11=1` → build toxic without X11 support (needed for focus tracking)
|
||||
* `DISABLE_AV=1` → build toxic without audio call support
|
||||
|
27
Makefile
27
Makefile
@ -3,13 +3,15 @@ CFG_DIR = $(BASE_DIR)/cfg
|
||||
|
||||
-include $(CFG_DIR)/global_vars.mk
|
||||
|
||||
LIBS = toxcore ncursesw libconfig
|
||||
LIBS = toxcore ncursesw libconfig libcurl
|
||||
|
||||
CFLAGS = -std=gnu99 -pthread -Wall -g -fstack-protector-all
|
||||
CFLAGS ?= -g
|
||||
CFLAGS += -std=gnu99 -pthread -Wall -fstack-protector-all
|
||||
CFLAGS += '-DTOXICVER="$(VERSION)"' -DHAVE_WIDECHAR -D_XOPEN_SOURCE_EXTENDED -D_FILE_OFFSET_BITS=64
|
||||
CFLAGS += '-DPACKAGE_DATADIR="$(abspath $(DATADIR))"'
|
||||
CFLAGS += $(USER_CFLAGS)
|
||||
LDFLAGS = $(USER_LDFLAGS)
|
||||
CFLAGS += ${USER_CFLAGS}
|
||||
LDFLAGS ?=
|
||||
LDFLAGS += ${USER_LDFLAGS}
|
||||
|
||||
OBJ = autocomplete.o avatars.o bootstrap.o chat.o chat_commands.o configdir.o curl_util.o execute.o
|
||||
OBJ += file_transfers.o friendlist.o global_commands.o group_commands.o groupchat.o help.o input.o
|
||||
@ -19,26 +21,19 @@ OBJ += term_mplex.o toxic.o toxic_strings.o windows.o
|
||||
# Check on wich system we are running
|
||||
UNAME_S = $(shell uname -s)
|
||||
ifeq ($(UNAME_S), Linux)
|
||||
-include $(CFG_DIR)/systems/Linux.mk
|
||||
endif
|
||||
ifeq ($(UNAME_S), FreeBSD)
|
||||
-include $(CFG_DIR)/systems/FreeBSD.mk
|
||||
endif
|
||||
ifeq ($(UNAME_S), DragonFly)
|
||||
-include $(CFG_DIR)/systems/FreeBSD.mk
|
||||
LDFLAGS += -ldl -lrt
|
||||
endif
|
||||
ifeq ($(UNAME_S), OpenBSD)
|
||||
-include $(CFG_DIR)/systems/FreeBSD.mk
|
||||
LIBS := $(filter-out ncursesw, $(LIBS))
|
||||
LDFLAGS += -lncursesw
|
||||
endif
|
||||
ifeq ($(UNAME_S), NetBSD)
|
||||
-include $(CFG_DIR)/systems/FreeBSD.mk
|
||||
LIBS := $(filter-out ncursesw, $(LIBS))
|
||||
LDFLAGS += -lncursesw
|
||||
endif
|
||||
ifeq ($(UNAME_S), Darwin)
|
||||
-include $(CFG_DIR)/systems/Darwin.mk
|
||||
endif
|
||||
ifeq ($(UNAME_S), Solaris)
|
||||
-include $(CFG_DIR)/systems/Solaris.mk
|
||||
endif
|
||||
|
||||
# Check on which platform we are running
|
||||
UNAME_M = $(shell uname -m)
|
||||
|
@ -23,10 +23,10 @@ SNDFILES += ToxicRecvMessage.wav ToxicOutgoingCall.wav ToxicIncomingCall.wav
|
||||
SNDFILES += ToxicTransferComplete.wav ToxicTransferStart.wav
|
||||
|
||||
# Install directories
|
||||
PREFIX = /usr/local
|
||||
PREFIX ?= /usr/local
|
||||
BINDIR = $(PREFIX)/bin
|
||||
DATADIR = $(PREFIX)/share/toxic
|
||||
MANDIR = $(PREFIX)/share/man
|
||||
MANDIR ?= $(PREFIX)/share/man
|
||||
APPDIR = $(PREFIX)/share/applications
|
||||
|
||||
# Platform tools
|
||||
|
@ -1,4 +0,0 @@
|
||||
# Specials options for freebsd systems
|
||||
LIBS := $(filter-out ncursesw, $(LIBS))
|
||||
LDFLAGS += -lncursesw -lcurl
|
||||
MANDIR = $(PREFIX)/man
|
@ -1,4 +0,0 @@
|
||||
# Specials options for linux systems
|
||||
CFLAGS +=
|
||||
LDFLAGS += -ldl -lrt -lcurl
|
||||
MANDIR = $(PREFIX)/share/man
|
@ -21,5 +21,15 @@ help:
|
||||
@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 " MANDIR: Specify a directory where to store man pages (default is \"$(abspath $(PREFIX)/share/man)\")"
|
||||
@echo
|
||||
@echo "-- Environment Variables --"
|
||||
@echo " CFLAGS: Add custom flags to default CFLAGS"
|
||||
@echo " LDFLAGS: Add custom flags to default LDFLAGS"
|
||||
@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 " MANDIR: Specify a directory where to store man pages (default is \"$(abspath $(PREFIX)/share/man)\")"
|
||||
|
||||
.PHONY: help
|
||||
|
@ -27,7 +27,7 @@ install: $(BUILD_DIR)/toxic
|
||||
if [ ! -e "$(DOC_DIR)/$$f" ]; then \
|
||||
continue ;\
|
||||
fi ;\
|
||||
section=$(abspath $(DESTDIR)/$(MANDIR))/man`echo $$f | rev | cut -d "." -f 1` ;\
|
||||
section=$(abspath $(DESTDIR)/$(MANDIR))/man`echo $${f##*.}` ;\
|
||||
file=$$section/$$f ;\
|
||||
mkdir -p $$section ;\
|
||||
install -m 0644 $(DOC_DIR)/$$f $$file ;\
|
||||
|
@ -16,7 +16,7 @@ uninstall:
|
||||
|
||||
@echo "Removing man pages"
|
||||
@for f in $(MANFILES) ; do \
|
||||
section=$(abspath $(DESTDIR)/$(MANDIR))/man`echo $$f | rev | cut -d "." -f 1` ;\
|
||||
section=$(abspath $(DESTDIR)/$(MANDIR))/man`echo $${f##*.}` ;\
|
||||
file=$$section/$$f ;\
|
||||
rm -f $$file $$file.gz ;\
|
||||
done
|
||||
|
@ -37,10 +37,10 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
#if defined(__linux__)
|
||||
#include <linux/videodev2.h>
|
||||
#else
|
||||
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
#include <sys/videoio.h>
|
||||
#else
|
||||
#include <linux/videodev2.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -71,7 +71,7 @@ typedef struct VideoDevice {
|
||||
void *cb_data; /* Data to be passed to callback */
|
||||
int32_t friend_number; /* ToxAV friend number */
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#if !defined(__OSX__)
|
||||
int fd; /* File descriptor of video device selected/opened */
|
||||
struct v4l2_format fmt;
|
||||
struct VideoBuffer *buffers;
|
||||
@ -136,7 +136,7 @@ static void yuv420tobgr(uint16_t width, uint16_t height, const uint8_t *y,
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#if !defined(__OSX__)
|
||||
static void yuv422to420(uint8_t *plane_y, uint8_t *plane_u, uint8_t *plane_v,
|
||||
uint8_t *input, uint16_t width, uint16_t height)
|
||||
{
|
||||
@ -748,7 +748,7 @@ void *video_thread_poll(void *arg) // TODO: maybe use thread for every input so
|
||||
XFlush(device->x_display);
|
||||
free(img_data);
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#if !defined(__OSX__)
|
||||
|
||||
if (-1 == xioctl(device->fd, VIDIOC_QBUF, &buf)) {
|
||||
unlock;
|
||||
@ -813,9 +813,9 @@ VideoDeviceError close_video_device(VideoDeviceType type, uint32_t device_idx)
|
||||
XCloseDisplay(device->x_display);
|
||||
pthread_mutex_destroy(device->mutex);
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#if !defined(__OSX__)
|
||||
free(device->buffers);
|
||||
#endif /* __linux__ / BSD */
|
||||
#endif /* not __OSX__ */
|
||||
|
||||
free(device);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user