summaryrefslogtreecommitdiff
path: root/package/supl
diff options
context:
space:
mode:
Diffstat (limited to 'package/supl')
-rw-r--r--package/supl/Makefile34
-rw-r--r--package/supl/patches/patch-configure11
-rw-r--r--package/supl/patches/patch-src_Makefile16
-rw-r--r--package/supl/patches/patch-src_supl-client_c40
-rw-r--r--package/supl/patches/patch-src_supl_c46
-rw-r--r--package/supl/patches/patch-src_supl_h19
6 files changed, 166 insertions, 0 deletions
diff --git a/package/supl/Makefile b/package/supl/Makefile
new file mode 100644
index 000000000..13e58560f
--- /dev/null
+++ b/package/supl/Makefile
@@ -0,0 +1,34 @@
+# This file is part of the OpenADK project. OpenADK is copyrighted
+# material, please see the LICENCE file in the top-level directory.
+
+include $(ADK_TOPDIR)/rules.mk
+
+PKG_NAME:= supl
+PKG_VERSION:= 1.0.6
+PKG_RELEASE:= 1
+PKG_HASH:= 068dc47ce818ce5634f09a88159df85a6ce3456e2467b11b8c5f8543a99bb347
+PKG_DESCR:= tools for accessing sup/rrlp server
+PKG_SECTION:= net/misc
+PKG_BUILDDEP:= openssl
+PKG_DEPENDS:= libopenssl
+PKG_URL:= http://www.tajuma.com/supl/
+PKG_SITES:= $(MASTER_SITE_SOURCEFORGE:=supl/)
+
+DISTFILES:= $(PKG_NAME)_$(PKG_VERSION).tar.gz
+WRKDIST= $(WRKDIR)/trunk
+
+include $(ADK_TOPDIR)/mk/package.mk
+
+$(eval $(call PKG_template,SUPL,supl,$(PKG_VERSION)-$(PKG_RELEASE),$(PKG_DEPENDS),$(PKG_DESCR),$(PKG_SECTION)))
+
+CONFIG_STYLE:= minimal
+CONFIGURE_ARGS+= --precompiled-asn1=yes --prefix="$(WRKINST)/usr"
+
+supl-install:
+ $(INSTALL_DIR) $(IDIR_SUPL)/usr/{bin,lib}
+ $(INSTALL_BIN) $(WRKINST)/usr/bin/supl-{cert,client,proxy} \
+ $(IDIR_SUPL)/usr/bin
+ $(CP) $(WRKINST)/usr/lib/lib{asnrrlp,asnsupl,supl}.so* \
+ $(IDIR_SUPL)/usr/lib
+
+include $(ADK_TOPDIR)/mk/pkg-bottom.mk
diff --git a/package/supl/patches/patch-configure b/package/supl/patches/patch-configure
new file mode 100644
index 000000000..1c8f24d49
--- /dev/null
+++ b/package/supl/patches/patch-configure
@@ -0,0 +1,11 @@
+--- trunk.orig/configure 2011-10-25 21:41:03.000000000 +0200
++++ trunk/configure 2015-02-27 19:33:11.000000000 +0100
+@@ -91,7 +91,7 @@ cat <<EOF > config.mk
+ # Modifications to this file are lost if ./configure is ran again.
+
+ CONF_VERSION = 1.0.5
+-CONF_CFLAGS = -Wall -O2 $var_debug
++CONF_CFLAGS = -Wall $var_debug
+ CONF_ASN_CFLAGS = $var_asn1_debug
+ CONF_PREFIX = $var_prefix
+ CONF_PRECOMPILED_ASN = $var_precompiled_asn
diff --git a/package/supl/patches/patch-src_Makefile b/package/supl/patches/patch-src_Makefile
new file mode 100644
index 000000000..cec5a4771
--- /dev/null
+++ b/package/supl/patches/patch-src_Makefile
@@ -0,0 +1,16 @@
+ - use pkg-config everywhere, otherwise libs are not found
+--- trunk.orig/src/Makefile 2011-10-17 20:09:22.000000000 +0200
++++ trunk/src/Makefile 2015-02-09 16:48:37.244935714 +0100
+@@ -21,10 +21,10 @@ DIST = Makefile $(PROGRAM_SOURCE) $(SUPL
+ all: supl-client supl-proxy supl-cert
+
+ supl-client: libsupl.so supl-client.o
+- $(CC) -o $@ supl-client.o -L. -lsupl -lssl -lm
++ $(CC) -o $@ supl-client.o -L. -lsupl $(shell pkg-config --libs openssl) -lm
+
+ supl-proxy: libsupl.so supl-proxy.o
+- $(CC) -o $@ supl-proxy.o -L. -lsupl -lssl -lm
++ $(CC) -o $@ supl-proxy.o -L. -lsupl $(shell pkg-config --libs openssl) -lm
+
+ supl-cert: supl-cert.o
+ $(CC) -o $@ supl-cert.o $(shell pkg-config --libs openssl) -lm
diff --git a/package/supl/patches/patch-src_supl-client_c b/package/supl/patches/patch-src_supl-client_c
new file mode 100644
index 000000000..15e2fa727
--- /dev/null
+++ b/package/supl/patches/patch-src_supl-client_c
@@ -0,0 +1,40 @@
+ - implement bind to device functionality
+--- trunk.orig/src/supl-client.c 2011-10-21 20:51:38.000000000 +0200
++++ trunk/src/supl-client.c 2013-04-24 18:55:01.937252375 +0200
+@@ -252,6 +252,7 @@ static char *usage_str =
+ " --cell gsm:mcc,mns:lac,ci|wcdma:mcc,msn,uc set current gsm/wcdma cell id\n"
+ " --cell gsm:mcc,mns:lac,ci:lat,lon,uncert set known gsm cell id with position\n"
+ " --format|-f human machine parseable output\n"
++" --interface|-i iface bind to this interface\n"
+ " --debug|-d <n> 1 == RRLP, 2 == SUPL, 4 == DEBUG\n"
+ " --debug-file file write debug to file\n"
+ " --help|-h show this help\n"
+@@ -267,6 +268,7 @@ static struct option long_opts[] = {
+ { "cell", 1, 0, 0 },
+ { "debug", 1, 0, 'd' },
+ { "format", 1, 0, 'f' },
++ { "interface", 1, 0, 0},
+ { "test", 1, 0, 't' },
+ { "set-pos", 1, 0, 0 },
+ { "pos-helper", 1, 0, 0 },
+@@ -310,7 +312,7 @@ int main(int argc, char *argv[]) {
+ int opt_index;
+ int c;
+
+- c = getopt_long(argc, argv, "ad:f:t:", long_opts, &opt_index);
++ c = getopt_long(argc, argv, "ad:f:i:t:", long_opts, &opt_index);
+ if (c == -1) break;
+ switch (c) {
+ case 0:
+@@ -374,6 +376,11 @@ int main(int argc, char *argv[]) {
+ }
+ break;
+
++ case 'i':
++ strncpy(ctx.iface, optarg, IFNAMSIZ);
++ ctx.iface[IFNAMSIZ] = 0;
++ break;
++
+ case 'd':
+ {
+ int debug = atoi(optarg);
diff --git a/package/supl/patches/patch-src_supl_c b/package/supl/patches/patch-src_supl_c
new file mode 100644
index 000000000..26ab45b18
--- /dev/null
+++ b/package/supl/patches/patch-src_supl_c
@@ -0,0 +1,46 @@
+ - implement bind to device functionality
+--- trunk.orig/src/supl.c 2011-10-27 20:41:19.000000000 +0200
++++ trunk/src/supl.c 2013-04-24 18:56:17.742529773 +0200
+@@ -41,7 +41,7 @@ static struct supl_debug_s {
+ } debug;
+ #endif
+
+-static int server_connect(char *server);
++static int server_connect(char *server, char *iface);
+ static int pdu_make_ulp_start(supl_ctx_t *ctx, supl_ulp_t *pdu);
+ static int pdu_make_ulp_pos_init(supl_ctx_t *ctx, supl_ulp_t *pdu);
+ static int pdu_make_ulp_rrlp_ack(supl_ctx_t *ctx, supl_ulp_t *pdu, PDU_t *rrlp);
+@@ -236,7 +236,7 @@ int EXPORT supl_server_connect(supl_ctx_
+ if (!ctx->ssl) return E_SUPL_CONNECT;
+
+ if (server) {
+- ctx->fd = server_connect(server);
++ ctx->fd = server_connect(server, ctx->iface);
+ if (ctx->fd == -1) return E_SUPL_CONNECT;
+ }
+
+@@ -266,7 +266,7 @@ void EXPORT supl_close(supl_ctx_t *ctx)
+ }
+
+
+-static int server_connect(char *server) {
++static int server_connect(char *server, char *iface) {
+ int fd = -1;
+ struct addrinfo *ailist, *aip;
+ struct addrinfo hint;
+@@ -283,6 +283,15 @@ static int server_connect(char *server)
+ if ((fd = socket(aip->ai_family, SOCK_STREAM, 0)) < 0) {
+ err = errno;
+ }
++
++ if (strlen(iface)) {
++ struct ifreq ifr;
++ strncpy(ifr.ifr_name, iface, IFNAMSIZ);
++ ifr.ifr_name[IFNAMSIZ - 1] = 0;
++ if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr)))
++ fprintf(stderr, "Error: binding to device %s failed\n", iface);
++ }
++
+ if (connect(fd, aip->ai_addr, aip->ai_addrlen) != 0) {
+ return -1;
+ }
diff --git a/package/supl/patches/patch-src_supl_h b/package/supl/patches/patch-src_supl_h
new file mode 100644
index 000000000..c2e9e8da4
--- /dev/null
+++ b/package/supl/patches/patch-src_supl_h
@@ -0,0 +1,19 @@
+ - implement bind to device functionality
+--- trunk.orig/src/supl.h 2011-10-21 20:08:29.000000000 +0200
++++ trunk/src/supl.h 2013-04-24 18:52:14.916232733 +0200
+@@ -19,6 +19,7 @@
+ #include <openssl/ssl.h>
+ #include <PDU.h>
+ #include <ULP-PDU.h>
++#include <net/if.h>
+
+ #define SUPL_PORT "7275"
+
+@@ -204,6 +205,7 @@ typedef struct supl_ctx_s {
+ size_t size;
+ } slp_session_id;
+
++ char iface[IFNAMSIZ + 1];
+ } supl_ctx_t;
+
+ int supl_ctx_new(supl_ctx_t *ctx);