summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Iooss2016-08-19 13:48:43 +0200
committerAlexandre Iooss2016-08-19 13:48:43 +0200
commit6f7a34571cdee9dd018e93fcee5ff6df1b84d5c5 (patch)
tree51f4e8c0b19f4e7071bd9638cc28b0bf39d2515c
downloadaur-6f7a34571cdee9dd018e93fcee5ff6df1b84d5c5.tar.gz
First commit
-rw-r--r--.SRCINFO26
-rw-r--r--.gitignore2
-rw-r--r--0001-Fix-json-c.patch75
-rw-r--r--Config-linux-config.h200
-rw-r--r--LICENSE28
-rw-r--r--PKGBUILD67
-rw-r--r--libardiscovery-Makefile29
7 files changed, 427 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..a07762f701d
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,26 @@
+pkgbase = libardiscovery-git
+ pkgdesc = ARSDK Discovery and Connection Management Layer
+ pkgver = r423.cb4f019
+ pkgrel = 1
+ url = http://developer.parrot.com/
+ arch = x86_64
+ license = custom
+ makedepends = git
+ depends = libarsal-git
+ depends = libarnetworkal-git
+ depends = libarnetwork-git
+ depends = json-c
+ depends = avahi
+ source = libardiscovery::git+https://github.com/Parrot-Developers/libARDiscovery
+ source = libardiscovery-Makefile
+ source = 0001-Fix-json-c.patch
+ source = Config-linux-config.h
+ source = LICENSE
+ sha256sums = SKIP
+ sha256sums = 0904602bdd8ae1d6b1a5923f2c16512dbdb90acddef0c35b7726831bad533c1c
+ sha256sums = 74300421b1799e0a32dc62eeded41b56a756b9c4ba95ad42402373e9ea9c3c44
+ sha256sums = 5956b54ef47ad26df51991a4aa7002abdcb524a51b455d040f55b4d11a4f44a7
+ sha256sums = 1771e95329e9cb2bed04e023e330af3d558d0f13c0c1c5de0581f2880f149deb
+
+pkgname = libardiscovery-git
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000000..50c16125886
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+libardiscovery/
+*.pkg.tar.xz
diff --git a/0001-Fix-json-c.patch b/0001-Fix-json-c.patch
new file mode 100644
index 00000000000..502efde3b67
--- /dev/null
+++ b/0001-Fix-json-c.patch
@@ -0,0 +1,75 @@
+--- a/libardiscovery/Includes/libARDiscovery/ARDISCOVERY_Device.h
++++ b/libardiscovery/Includes/libARDiscovery/ARDISCOVERY_Device.h
+@@ -38,7 +38,7 @@
+ #ifndef _ARDISCOVERY_DEVICE_H_
+ #define _ARDISCOVERY_DEVICE_H_
+
+-#include <json/json.h>
++#include <json-c/json.h>
+ #include <libARNetworkAL/ARNETWORKAL_Manager.h>
+ #include <libARNetworkAL/ARNETWORKAL_Error.h>
+ #include <libARNetwork/ARNETWORK_IOBufferParam.h>
+--- a/libardiscovery/Sources/BLE/ARDISCOVERY_DEVICE_Ble.c
++++ b/libardiscovery/Sources/BLE/ARDISCOVERY_DEVICE_Ble.c
+@@ -37,7 +37,7 @@
+ */
+
+ #include <stdlib.h>
+-#include <json/json.h>
++#include <json-c/json.h>
+ #include <libARSAL/ARSAL_Print.h>
+ #include <libARNetworkAL/ARNETWORKAL_Manager.h>
+ #include <libARNetworkAL/ARNETWORKAL_Error.h>
+--- a/libardiscovery/Sources/BLE/ARDISCOVERY_DEVICE_Ble.h
++++ b/libardiscovery/Sources/BLE/ARDISCOVERY_DEVICE_Ble.h
+@@ -38,7 +38,7 @@
+ #ifndef _ARDISCOVERY_DEVICE_BLE_H_
+ #define _ARDISCOVERY_DEVICE_BLE_H_
+
+-#include <json/json.h>
++#include <json-c/json.h>
+ #include <libARNetworkAL/ARNETWORKAL_Manager.h>
+ #include <libARNetworkAL/ARNETWORKAL_Error.h>
+ #include <libARNetwork/ARNETWORK_IOBufferParam.h>
+--- a/libardiscovery/Sources/Wifi/ARDISCOVERY_DEVICE_Wifi.c
++++ b/libardiscovery/Sources/Wifi/ARDISCOVERY_DEVICE_Wifi.c
+@@ -37,7 +37,7 @@
+ */
+
+ #include <stdlib.h>
+-#include <json/json.h>
++#include <json-c/json.h>
+ #include <libARSAL/ARSAL_Print.h>
+ #include <libARNetworkAL/ARNETWORKAL_Manager.h>
+ #include <libARNetworkAL/ARNETWORKAL_Error.h>
+--- a/libardiscovery/Sources/Wifi/ARDISCOVERY_DEVICE_Wifi.h
++++ b/libardiscovery/Sources/Wifi/ARDISCOVERY_DEVICE_Wifi.h
+@@ -38,7 +38,7 @@
+ #ifndef _ARDISCOVERY_DEVICE_WIFI_H_
+ #define _ARDISCOVERY_DEVICE_WIFI_H_
+
+-#include <json/json.h>
++#include <json-c/json.h>
+ #include <libARNetworkAL/ARNETWORKAL_Manager.h>
+ #include <libARNetworkAL/ARNETWORKAL_Error.h>
+ #include <libARNetwork/ARNETWORK_IOBufferParam.h>
+--- a/libardiscovery/Sources/Wifi/ARDISCOVERY_DEVICE_Wifi.c
++++ b/libardiscovery/Sources/Wifi/ARDISCOVERY_DEVICE_Wifi.c
+@@ -1189,7 +1189,7 @@ eARDISCOVERY_ERROR ARDISCOVERY_DEVICE_Wifi_ReceiveJsonCallback (uint8_t *dataRx,
+ if (error == ARDISCOVERY_OK)
+ {
+ // get ARDISCOVERY_CONNECTION_JSON_C2DPORT_KEY
+- valueJsonObj = json_object_object_get (jsonObj, ARDISCOVERY_CONNECTION_JSON_C2DPORT_KEY);
++ json_object_object_get_ex (jsonObj, ARDISCOVERY_CONNECTION_JSON_C2DPORT_KEY, &valueJsonObj);
+ if (valueJsonObj != NULL)
+ {
+ specificWifiParam->controllerToDevicePort = json_object_get_int(valueJsonObj);
+@@ -1197,7 +1197,7 @@ eARDISCOVERY_ERROR ARDISCOVERY_DEVICE_Wifi_ReceiveJsonCallback (uint8_t *dataRx,
+
+ // get ARDISCOVERY_CONNECTION_JSON_STATUS_KEY
+
+- valueJsonObj = json_object_object_get (jsonObj, ARDISCOVERY_CONNECTION_JSON_STATUS_KEY);
++ json_object_object_get_ex (jsonObj, ARDISCOVERY_CONNECTION_JSON_STATUS_KEY, &valueJsonObj);
+ if (valueJsonObj != NULL)
+ {
+ specificWifiParam->connectionStatus = json_object_get_int(valueJsonObj);
diff --git a/Config-linux-config.h b/Config-linux-config.h
new file mode 100644
index 00000000000..dc8a5ded865
--- /dev/null
+++ b/Config-linux-config.h
@@ -0,0 +1,200 @@
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Debug Mode */
+/* #undef DEBUG */
+
+/* Define to 1 if you have the declaration of `PRIi16', and to 0 if you don't.
+ */
+#define HAVE_DECL_PRII16 1
+
+/* Define to 1 if you have the declaration of `PRIi32', and to 0 if you don't.
+ */
+#define HAVE_DECL_PRII32 1
+
+/* Define to 1 if you have the declaration of `PRIi64', and to 0 if you don't.
+ */
+#define HAVE_DECL_PRII64 1
+
+/* Define to 1 if you have the declaration of `PRIi8', and to 0 if you don't.
+ */
+#define HAVE_DECL_PRII8 1
+
+/* Define to 1 if you have the declaration of `PRIu16', and to 0 if you don't.
+ */
+#define HAVE_DECL_PRIU16 1
+
+/* Define to 1 if you have the declaration of `PRIu32', and to 0 if you don't.
+ */
+#define HAVE_DECL_PRIU32 1
+
+/* Define to 1 if you have the declaration of `PRIu64', and to 0 if you don't.
+ */
+#define HAVE_DECL_PRIU64 1
+
+/* Define to 1 if you have the declaration of `PRIu8', and to 0 if you don't.
+ */
+#define HAVE_DECL_PRIU8 1
+
+/* Define to 1 if you have the <android/log.h> header file. */
+/* #undef HAVE_ANDROID_LOG_H */
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#define HAVE_CLOCK_GETTIME 1
+
+/* Define to 1 if you have the <CoreBluetooth/CoreBluetooth.h> header file. */
+/* #undef HAVE_COREBLUETOOTH_COREBLUETOOTH_H */
+
+/* Define to 1 if you have the declaration of `MSG_NOSIGNAL', and to 0 if you
+ don't. */
+#ifdef __linux__
+# define HAVE_DECL_MSG_NOSIGNAL 1
+#else
+# define HAVE_DECL_MSG_NOSIGNAL 0
+#endif
+
+/* Define to 1 if you have the declaration of `SO_NOSIGPIPE', and to 0 if you
+ don't. */
+#ifdef __linux__
+# define HAVE_DECL_SO_NOSIGPIPE 0
+#else
+# define HAVE_DECL_SO_NOSIGPIPE 1
+#endif
+
+/* Define to 1 if you have the declaration of `CLOCK_MONOTONIC', and to 0 if
+ you don't. */
+#ifdef __linux__
+# define HAVE_DECL_CLOCK_MONOTONIC 1
+#else
+# define HAVE_DECL_CLOCK_MONOTONIC 0
+#endif
+
+/* Define to 1 if you have the declaration of `CLOCK_REALTIME', and to 0 if
+ you don't. */
+#ifdef __linux__
+# define HAVE_DECL_CLOCK_REALTIME 1
+#else
+# define HAVE_DECL_CLOCK_REALTIME 0
+#endif
+
+/* Define to 1 if you have the declaration of `log2', and to 0 if you don't.
+ */
+#define HAVE_DECL_LOG2 1
+
+/* Define to 1 if you have the declaration of `SYS_gettid', and to 0 if you
+ don't. */
+#define HAVE_DECL_SYS_GETTID 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <ftw.h> header file. */
+#define HAVE_FTW_H 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Whether the libm on the host has the log2 function */
+#define HAVE_LOG2 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define to 1 if you have the <pthread.h> header file. */
+#define HAVE_PTHREAD_H 1
+
+/* Define to 1 if you have the <semaphore.h> header file. */
+#define HAVE_SEMAPHORE_H 1
+
+/* Define to 1 if you have the `sem_destroy' function. */
+#define HAVE_SEM_DESTROY 1
+
+/* Define to 1 if you have the `sem_getvalue' function. */
+#define HAVE_SEM_GETVALUE 1
+
+/* Define to 1 if you have the `sem_init' function. */
+#define HAVE_SEM_INIT 1
+
+/* Define to 1 if you have the `sem_post' function. */
+#define HAVE_SEM_POST 1
+
+/* Define to 1 if you have the `sem_timedwait' function. */
+#ifdef __linux__
+# define HAVE_SEM_TIMEDWAIT 1
+#endif
+
+/* Define to 1 if you have the `sem_trywait' function. */
+#define HAVE_SEM_TRYWAIT 1
+
+/* Define to 1 if you have the `sem_wait' function. */
+#define HAVE_SEM_WAIT 1
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#define HAVE_STDARG_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdio.h> header file. */
+#define HAVE_STDIO_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#define HAVE_SYS_UIO_H 1
+
+/* Define to 1 if you have the `time' function. */
+#define HAVE_TIME 1
+
+/* Define to 1 if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <sys/statfs.h> header file. */
+#ifdef __linux__
+# define HAVE_SYS_STATFS_H 1
+#endif
+
+/* Define to 1 if you have the <sys/mount.h> header file. */
+#define HAVE_SYS_MOUNT_H 1
+
+/* No-debug Mode */
+#define NDEBUG /**/
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you have the <sys/mount.h> header file. */
+#define HAVE_SYS_MOUNT_H 1
+
+/* Define to 1 if you have the <UIKit/UIKit.h> header file. */
+/* #undef HAVE_UIKIT_UIKIT_H */
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000000..2b9256f4825
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,28 @@
+Copyright (C) 2014 Parrot SA
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+* Neither the name of Parrot nor the names
+ of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..608fe791366
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,67 @@
+# Maintainer: Alexandre Iooss <alexandre.iooss@gmail.com>
+
+pkgname=libardiscovery-git
+pkgver=r423.cb4f019
+pkgrel=1
+pkgdesc="ARSDK Discovery and Connection Management Layer"
+arch=(x86_64)
+url="http://developer.parrot.com/"
+license=('custom')
+groups=()
+depends=(libarsal-git libarnetworkal-git libarnetwork-git json-c avahi)
+optdepends=()
+makedepends=(git)
+provides=()
+conflicts=()
+replaces=()
+backup=()
+options=()
+install=
+source=('libardiscovery::git+https://github.com/Parrot-Developers/libARDiscovery'
+ 'libardiscovery-Makefile'
+ '0001-Fix-json-c.patch'
+ 'Config-linux-config.h'
+ 'LICENSE')
+sha256sums=('SKIP'
+ '0904602bdd8ae1d6b1a5923f2c16512dbdb90acddef0c35b7726831bad533c1c'
+ '74300421b1799e0a32dc62eeded41b56a756b9c4ba95ad42402373e9ea9c3c44'
+ '5956b54ef47ad26df51991a4aa7002abdcb524a51b455d040f55b4d11a4f44a7'
+ '1771e95329e9cb2bed04e023e330af3d558d0f13c0c1c5de0581f2880f149deb')
+
+pkgver() {
+ cd "$srcdir/libardiscovery"
+ printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+}
+
+prepare() {
+ cp "$srcdir/libardiscovery-Makefile" "$srcdir/libardiscovery/Makefile"
+ cp "$srcdir/Config-linux-config.h" "$srcdir/libardiscovery/Includes/config.h"
+
+ # Patch to use latest json-c
+ patch -p1 -i "$srcdir/0001-Fix-json-c.patch"
+}
+
+build() {
+ cd "$srcdir/libardiscovery"
+ make
+}
+
+package() {
+ # Install headers
+ mkdir -p "$pkgdir/usr/include/libARDiscovery"
+ cp "$srcdir/libardiscovery/Includes/libARDiscovery/ARDiscovery.h" "$pkgdir/usr/include/libARDiscovery/"
+ cp "$srcdir/libardiscovery/Includes/libARDiscovery/ARDISCOVERY_Connection.h" "$pkgdir/usr/include/libARDiscovery/"
+ cp "$srcdir/libardiscovery/Includes/libARDiscovery/ARDISCOVERY_Discovery.h" "$pkgdir/usr/include/libARDiscovery/"
+ cp "$srcdir/libardiscovery/Includes/libARDiscovery/ARDISCOVERY_NetworkConfiguration.h" "$pkgdir/usr/include/libARDiscovery/"
+ cp "$srcdir/libardiscovery/Includes/libARDiscovery/ARDISCOVERY_Device.h" "$pkgdir/usr/include/libARDiscovery/"
+ cp "$srcdir/libardiscovery/Includes/libARDiscovery/ARDISCOVERY_Error.h" "$pkgdir/usr/include/libARDiscovery/"
+ cp "$srcdir/libardiscovery/Includes/libARDiscovery/ARDISCOVERY_AvahiDiscovery.h" "$pkgdir/usr/include/libARDiscovery/"
+
+ # Install lib
+ mkdir -p "$pkgdir/usr/lib"
+ cp "$srcdir/libardiscovery/libardiscovery.so" "$pkgdir/usr/lib/"
+
+ # Install license
+ mkdir -p "$pkgdir/usr/share/licenses/$pkgname"
+ cp "$srcdir/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
diff --git a/libardiscovery-Makefile b/libardiscovery-Makefile
new file mode 100644
index 00000000000..635dd156c2c
--- /dev/null
+++ b/libardiscovery-Makefile
@@ -0,0 +1,29 @@
+CC = gcc
+CFLAGS = -fPIC -Wall -Wextra -O2 -g -IIncludes -DHAVE_CONFIG_H
+LDFLAGS = -shared
+RM = rm -f
+TARGET_LIB = libardiscovery.so
+
+SRCS = Sources/ARDISCOVERY_Connection.c \
+ Sources/ARDISCOVERY_Discovery.c \
+ Sources/ARDISCOVERY_Device.c \
+ Sources/Wifi/ARDISCOVERY_DEVICE_Wifi.c \
+ Sources/BLE/ARDISCOVERY_DEVICE_Ble.c \
+ gen/Sources/ARDISCOVERY_Error.c \
+ Sources/ARDISCOVERY_AvahiDiscovery.c
+OBJS = $(SRCS:.c=.o)
+
+.PHONY: all
+all: ${TARGET_LIB}
+
+$(TARGET_LIB): $(OBJS)
+ $(CC) ${LDFLAGS} -o $@ $^
+
+$(SRCS:.c=.d):%.d:%.c
+ $(CC) $(CFLAGS) -MM $< >$@
+
+include $(SRCS:.c=.d)
+
+.PHONY: clean
+clean:
+ -${RM} ${TARGET_LIB} ${OBJS} $(SRCS:.c=.d)