motion: fix postgresql support
[buildroot-gz.git] / package / motion / motion.mk
blob16ce406f84f22aa94406586c8fe8bfc014cc57af
1 ################################################################################
3 # motion
5 ################################################################################
7 MOTION_VERSION = release-3.4.1
8 MOTION_SITE = $(call github,Motion-Project,motion,$(MOTION_VERSION))
9 MOTION_LICENSE = GPLv2
10 MOTION_LICENSE_FILES = COPYING
11 MOTION_DEPENDENCIES = host-pkgconf jpeg
12 # From git and configure.ac is patched
13 MOTION_AUTORECONF = YES
15 # This patch fixes detection of sqlite when cross-compiling
16 MOTION_PATCH = \
17 https://github.com/Motion-Project/motion/commit/709f626b7ef83a2bb3ef1f77205276207ab27196.patch
19 # This patch adds --with-sdl=[DIR] option to fix detection of sdl-config
20 MOTION_PATCH += \
21 https://github.com/Motion-Project/motion/commit/72193ccaff83fcb074c9aaa37c5691a8d8a18c7c.patch
23 # motion does not use any specific function of jpeg-turbo, so just relies on
24 # jpeg selection
25 MOTION_CONF_OPTS += --without-jpeg-turbo
27 ifeq ($(BR2_PACKAGE_FFMPEG_SWSCALE),y)
28 MOTION_DEPENDENCIES += ffmpeg
29 MOTION_CONF_OPTS += --with-ffmpeg
30 else
31 MOTION_CONF_OPTS += --without-ffmpeg
32 endif
34 ifeq ($(BR2_PACKAGE_MYSQL),y)
35 MOTION_DEPENDENCIES += mysql
36 MOTION_CONF_OPTS += \
37 --with-mysql \
38 --with-mysql-include=$(STAGING_DIR)/usr/include/mysql \
39 --with-mysql-lib=$(STAGING_DIR)/usr/lib
40 else
41 MOTION_CONF_OPTS += --without-mysql
42 endif
44 ifeq ($(BR2_PACKAGE_POSTGRESQL),y)
45 MOTION_DEPENDENCIES += postgresql
46 MOTION_CONF_OPTS += \
47 --with-pgsql \
48 --with-pgsql-include=$(STAGING_DIR)/usr/include \
49 --with-pgsql-lib=$(STAGING_DIR)/usr/lib
50 else
51 MOTION_CONF_OPTS += --without-pgsql
52 endif
54 ifeq ($(BR2_PACKAGE_SDL),y)
55 MOTION_DEPENDENCIES += sdl
56 MOTION_CONF_OPTS += --with-sdl=$(STAGING_DIR)/usr
57 # overwrite ac_cv_path_CONFIG_SDL in case sdl development is
58 # installed on the host
59 MOTION_CONF_ENV += ac_cv_path_CONFIG_SDL=$(STAGING_DIR)/usr/bin/sdl-config
60 else
61 MOTION_CONF_OPTS += --without-sdl
62 endif
64 ifeq ($(BR2_PACKAGE_SQLITE),y)
65 MOTION_DEPENDENCIES += sqlite
66 MOTION_CONF_OPTS += --with-sqlite3
67 else
68 MOTION_CONF_OPTS += --without-sqlite3
69 endif
71 # Do not use default install target as it installs many unneeded files and
72 # directories: docs, examples and init scripts
73 define MOTION_INSTALL_TARGET_CMDS
74 $(INSTALL) -D -m 0644 $(@D)/motion-dist.conf \
75 $(TARGET_DIR)/etc/motion.conf
76 $(INSTALL) -D -m 0755 $(@D)/motion $(TARGET_DIR)/usr/bin/motion
77 endef
79 define MOTION_INSTALL_INIT_SYSV
80 $(INSTALL) -D -m 0755 package/motion/S99motion \
81 $(TARGET_DIR)/etc/init.d/S99motion
82 endef
84 define MOTION_INSTALL_INIT_SYSTEMD
85 $(INSTALL) -D -m 644 package/motion/motion.service \
86 $(TARGET_DIR)/usr/lib/systemd/system/motion.service
87 mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
88 ln -sf ../../../../usr/lib/systemd/system/motion.service \
89 $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/motion.service
90 endef
92 $(eval $(autotools-package))