Re: [OpenWrt-Devel] [PATCH] Add Lua bindings for libgps

2012-05-05 Thread Felix Fietkau
On 2012-05-05 10:20 PM, dave taht wrote:
> On 05/05/2012 01:17 PM, Felix Fietkau wrote:
>> On 2012-05-05 8:49 PM, Eric S. Raymond wrote:
>>> Felix Fietkau:
 I merged scons build support in r31618. I was just about to merge
 chrpath too, but it didn't build on my OSX box. When I found out what
 chrpath is used for in the build system, I decided to not merge it at all.
 If I understand the code that uses it in the gpsd build system
 correctly, it seems to be an unnecessary hack that should be patched out
 entirely.
>>> It's necessary for dynamic linking.  It replaces the elaborate stuff libtool
>>> does in an autotools-based build.
>> I really don't think we need it in OpenWrt, so I'm going to patch it
>> out. chrpath seems to need some ELF related stuff that isn't part of our
>> host build yet, and I think it is completely pointless to add all of
>> this for a piece of functionality that we don't need or want in OpenWrt
>> at all.
> Works for me.
> 
>> After fixing some madness wrt. scons platform detection (I'm beginning
>> to dislike scons even more than autoconf now)
> 
> That would be hard to imagine, but I feel your pain, I do, I do.
> 
>> , I tried my patched gpsd
>> package and it seemed to find its libraries just fine.
> Awesome.
> 
> I note that there was a great deal of churn happening after the 3.5 
> release, I don't know if eric considers it 3.5 stable enough or not. 
> Notably there was some stuff going by about endianness on the list that 
> appeared to be ibm360 related, which I know is not a target platform 
> (yet) for openwrt.
> 
> Does this mean I can retire the ceropackages version?
Committed the gpsd update in r31621

> I note that the xorp package therein needed scons too.
That one doesn't build for me yet but comes close (something pthread
related when linking), maybe I'll look into it some other day.

- Felix
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] Add Lua bindings for libgps

2012-05-05 Thread dave taht

On 05/05/2012 01:17 PM, Felix Fietkau wrote:

On 2012-05-05 8:49 PM, Eric S. Raymond wrote:

Felix Fietkau:

I merged scons build support in r31618. I was just about to merge
chrpath too, but it didn't build on my OSX box. When I found out what
chrpath is used for in the build system, I decided to not merge it at all.
If I understand the code that uses it in the gpsd build system
correctly, it seems to be an unnecessary hack that should be patched out
entirely.

It's necessary for dynamic linking.  It replaces the elaborate stuff libtool
does in an autotools-based build.

I really don't think we need it in OpenWrt, so I'm going to patch it
out. chrpath seems to need some ELF related stuff that isn't part of our
host build yet, and I think it is completely pointless to add all of
this for a piece of functionality that we don't need or want in OpenWrt
at all.

Works for me.


After fixing some madness wrt. scons platform detection (I'm beginning
to dislike scons even more than autoconf now)


That would be hard to imagine, but I feel your pain, I do, I do.


, I tried my patched gpsd
package and it seemed to find its libraries just fine.

Awesome.

I note that there was a great deal of churn happening after the 3.5 
release, I don't know if eric considers it 3.5 stable enough or not. 
Notably there was some stuff going by about endianness on the list that 
appeared to be ibm360 related, which I know is not a target platform 
(yet) for openwrt.


Does this mean I can retire the ceropackages version?

I note that the xorp package therein needed scons too.



- Felix


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] Add Lua bindings for libgps

2012-05-05 Thread Felix Fietkau
On 2012-05-05 8:49 PM, Eric S. Raymond wrote:
> Felix Fietkau :
>> I merged scons build support in r31618. I was just about to merge
>> chrpath too, but it didn't build on my OSX box. When I found out what
>> chrpath is used for in the build system, I decided to not merge it at all.
>> If I understand the code that uses it in the gpsd build system
>> correctly, it seems to be an unnecessary hack that should be patched out
>> entirely.
> 
> It's necessary for dynamic linking.  It replaces the elaborate stuff libtool
> does in an autotools-based build.
I really don't think we need it in OpenWrt, so I'm going to patch it
out. chrpath seems to need some ELF related stuff that isn't part of our
host build yet, and I think it is completely pointless to add all of
this for a piece of functionality that we don't need or want in OpenWrt
at all.

After fixing some madness wrt. scons platform detection (I'm beginning
to dislike scons even more than autoconf now), I tried my patched gpsd
package and it seemed to find its libraries just fine.

- Felix
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] Add Lua bindings for libgps

2012-05-05 Thread Felix Fietkau
On 2012-04-16 3:31 PM, Dave Taht wrote:
> On Mon, Apr 16, 2012 at 2:37 AM, Christian Gagneraud  
> wrote:
>> On 05/04/12 16:19, Dave Taht wrote:
>>>
>>> I note that I have been tracking the latest gpsds closely (with the new
>>> api)
>>>
>>> A problem is that it requires that scons support be added to the
>>> mainline openwrt build.
>>>
>>> Got patches for all that, could use some more testing...
>>
>>
>> Hi Dave,
>>
>> I'm interesting as well to see gpsd updated to the latest stable version,
>> would you mind to share your patches? I'll be happy to give them a try!
> 
> The newly released gpsd 3.5 is currently living in the ceropackages
> repository, and has only been tested on the wndr3700v2 (and not quite
> 3.5 was tested - 3.5 was released saturday)
> 
> It also requires that chkpath and scons support be added to the main openwrt .
> 
> (aformentioned scons support is also required for things like xorp)
> 
> you can either add the ceropackages repo to your feeds.conf
> 
> src-git cero git://github.com/dtaht/ceropackages.git
> ./scripts/feeds uninstall gpsd
> ./scripts/feeds install cero gpsd
> 
> or extract the latest gpsd package from:
> https://github.com/dtaht/ceropackages/tree/master/net
> 
> As for the scons and chrpath support, patches are at:
> 
> http://huchra.bufferbloat.net/~cero1/for_openwrt/
> 
> I'm sure eric would love to see gpsd 2.x retired from openwrt
> (and I'd love the lua interface you just did)
> 
> (hat off to swalker for packaging this stuff up and eric for taking
>  the openwrt related patches into his mainline)
I merged scons build support in r31618. I was just about to merge
chrpath too, but it didn't build on my OSX box. When I found out what
chrpath is used for in the build system, I decided to not merge it at all.
If I understand the code that uses it in the gpsd build system
correctly, it seems to be an unnecessary hack that should be patched out
entirely.

- Felix
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] Add Lua bindings for libgps

2012-04-21 Thread christian Gagneraud

On 04/16/2012 02:31 PM, Dave Taht wrote:

On Mon, Apr 16, 2012 at 2:37 AM, Christian Gagneraud  wrote:

On 05/04/12 16:19, Dave Taht wrote:

I note that I have been tracking the latest gpsds closely (with the new
api)

A problem is that it requires that scons support be added to the
mainline openwrt build.

Got patches for all that, could use some more testing...


Hi Dave,

I'm interesting as well to see gpsd updated to the latest stable version,
would you mind to share your patches? I'll be happy to give them a try!

The newly released gpsd 3.5 is currently living in the ceropackages
repository, and has only been tested on the wndr3700v2 (and not quite
3.5 was tested - 3.5 was released saturday)

It also requires that chkpath and scons support be added to the main openwrt .

(aformentioned scons support is also required for things like xorp)

you can either add the ceropackages repo to your feeds.conf

src-git cero git://github.com/dtaht/ceropackages.git
./scripts/feeds uninstall gpsd
./scripts/feeds install cero gpsd

or extract the latest gpsd package from:
https://github.com/dtaht/ceropackages/tree/master/net

As for the scons and chrpath support, patches are at:

http://huchra.bufferbloat.net/~cero1/for_openwrt/

I'm sure eric would love to see gpsd 2.x retired from openwrt
(and I'd love the lua interface you just did)


I've just send a patch on the luci mailing list, this is not very clean. 
but it's a good start I think.
I did not have time to test your 3.X version. It would be nice to have 
this version upstream here.

This way, i'll update my gpsd patch for luci.
On the side, I have as well a luci application for AIS related stuff. 
But this one is a bit more tricky to get the data on the client side. 
I'll speak more on this on the gpsd mailing list, as I would like to 
submit a contrib "aisd" python script.





(hat off to swalker for packaging this stuff up and eric for taking
  the openwrt related patches into his mainline)




Chris




On Thu, Apr 5, 2012 at 3:02 AM, Viktar Palstsiuk
wrote:

Signed-off-by: Viktar Palstsiuk
---
  lang/luagps/Makefile   |   50

  .../001-add_compatibility_with_old_gpsd_api.patch  |   62

  2 files changed, 112 insertions(+), 0 deletions(-)
  create mode 100644 lang/luagps/Makefile
  create mode 100644
lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch

diff --git a/lang/luagps/Makefile b/lang/luagps/Makefile
new file mode 100644
index 000..268e826
--- /dev/null
+++ b/lang/luagps/Makefile
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License
v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=luagps
+PKG_REV:=2d3dd6b1cc7b87891af19857bfedd2e1845d2e3b
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_REV).tar.bz2
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://github.com/jdegges/lua-gps.git
+PKG_SOURCE_VERSION:=$(PKG_REV)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/luagps
+  SUBMENU:=Lua
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Lua bindings for libgps
+  URL:=https://github.com/jdegges/lua-gps
+  DEPENDS:=+lua +gpsd
+endef
+
+define Package/luagps/description
+  Lua bindings for libgps.
+endef
+
+define Build/Configure
+endef
+
+TARGET_CFLAGS += $(FPIC) -shared -g -W -Wall
-I$(STAGING_DIR)/usr/include/
+TARGET_LDFLAGS += -lgps
+
+define Build/Compile
+   $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS)
$(PKG_BUILD_DIR)/lgps.c -o $(PKG_BUILD_DIR)/gps.so
+endef
+
+define Package/luagps/install
+   $(INSTALL_DIR) $(1)/usr/lib/lua
+   $(INSTALL_BIN) $(PKG_BUILD_DIR)/gps.so $(1)/usr/lib/lua/
+endef
+
+$(eval $(call BuildPackage,luagps))
diff --git
a/lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch
b/lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch
new file mode 100644
index 000..63a7f3d
--- /dev/null
+++ b/lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch
@@ -0,0 +1,62 @@
+--- a/lgps.c   2012-04-05 11:19:27.0 +0300
 b/lgps.c   2012-04-05 12:28:17.0 +0300
+@@ -30,7 +30,6 @@
+ static int
+ lgps_open (lua_State *L)
+ {
+-  int top = lua_gettop (L);
+   struct gps_data_t *ud = NULL;
+   const char *server = luaL_checkstring (L, 1);
+   const char *port = luaL_checkstring (L, 2);
+@@ -39,8 +38,13 @@
+   if (NULL == ud)
+ print_error ("out of memory");
+
++#if (GPSD_API_MAJOR_VERSION>4)
+   if (0 != gps_open (server, port, ud))
+ print_error ("no gpsd running or network error: %d, %s", errno,
gps_errstr (errno));
++#else
++  if (0 != gps_open_r (server, port, ud))
++print_error ("no gpsd running or network error: %d, %s", errno,
gps_errstr (errno));
++#endif
+
+   luaL_getmetatable (L, MT_GPS);
+   lua_setmetatable (L, -2);
+@@ -86,9 +90,13 @@
+ lgps_waiting (lua_State *L)
+ {
+   struct gps_data_t *ud = luaL_checkudata (L, 1, M

Re: [OpenWrt-Devel] [PATCH] Add Lua bindings for libgps

2012-04-16 Thread Dave Taht
On Mon, Apr 16, 2012 at 2:37 AM, Christian Gagneraud  wrote:
> On 05/04/12 16:19, Dave Taht wrote:
>>
>> I note that I have been tracking the latest gpsds closely (with the new
>> api)
>>
>> A problem is that it requires that scons support be added to the
>> mainline openwrt build.
>>
>> Got patches for all that, could use some more testing...
>
>
> Hi Dave,
>
> I'm interesting as well to see gpsd updated to the latest stable version,
> would you mind to share your patches? I'll be happy to give them a try!

The newly released gpsd 3.5 is currently living in the ceropackages
repository, and has only been tested on the wndr3700v2 (and not quite
3.5 was tested - 3.5 was released saturday)

It also requires that chkpath and scons support be added to the main openwrt .

(aformentioned scons support is also required for things like xorp)

you can either add the ceropackages repo to your feeds.conf

src-git cero git://github.com/dtaht/ceropackages.git
./scripts/feeds uninstall gpsd
./scripts/feeds install cero gpsd

or extract the latest gpsd package from:
https://github.com/dtaht/ceropackages/tree/master/net

As for the scons and chrpath support, patches are at:

http://huchra.bufferbloat.net/~cero1/for_openwrt/

I'm sure eric would love to see gpsd 2.x retired from openwrt
(and I'd love the lua interface you just did)

(hat off to swalker for packaging this stuff up and eric for taking
 the openwrt related patches into his mainline)



>
> Chris
>
>
>
>>
>> On Thu, Apr 5, 2012 at 3:02 AM, Viktar Palstsiuk
>>   wrote:
>>>
>>> Signed-off-by: Viktar Palstsiuk
>>> ---
>>>  lang/luagps/Makefile                               |   50
>>> 
>>>  .../001-add_compatibility_with_old_gpsd_api.patch  |   62
>>> 
>>>  2 files changed, 112 insertions(+), 0 deletions(-)
>>>  create mode 100644 lang/luagps/Makefile
>>>  create mode 100644
>>> lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch
>>>
>>> diff --git a/lang/luagps/Makefile b/lang/luagps/Makefile
>>> new file mode 100644
>>> index 000..268e826
>>> --- /dev/null
>>> +++ b/lang/luagps/Makefile
>>> @@ -0,0 +1,50 @@
>>> +#
>>> +# Copyright (C) 2012 OpenWrt.org
>>> +#
>>> +# This is free software, licensed under the GNU General Public License
>>> v2.
>>> +# See /LICENSE for more information.
>>> +#
>>> +
>>> +include $(TOPDIR)/rules.mk
>>> +
>>> +PKG_NAME:=luagps
>>> +PKG_REV:=2d3dd6b1cc7b87891af19857bfedd2e1845d2e3b
>>> +PKG_RELEASE:=1
>>> +
>>> +PKG_SOURCE:=$(PKG_NAME)-$(PKG_REV).tar.bz2
>>> +PKG_SOURCE_SUBDIR:=$(PKG_NAME)
>>> +PKG_SOURCE_PROTO:=git
>>> +PKG_SOURCE_URL:=git://github.com/jdegges/lua-gps.git
>>> +PKG_SOURCE_VERSION:=$(PKG_REV)
>>> +
>>> +include $(INCLUDE_DIR)/package.mk
>>> +
>>> +define Package/luagps
>>> +  SUBMENU:=Lua
>>> +  SECTION:=lang
>>> +  CATEGORY:=Languages
>>> +  TITLE:=Lua bindings for libgps
>>> +  URL:=https://github.com/jdegges/lua-gps
>>> +  DEPENDS:=+lua +gpsd
>>> +endef
>>> +
>>> +define Package/luagps/description
>>> +  Lua bindings for libgps.
>>> +endef
>>> +
>>> +define Build/Configure
>>> +endef
>>> +
>>> +TARGET_CFLAGS += $(FPIC) -shared -g -W -Wall
>>> -I$(STAGING_DIR)/usr/include/
>>> +TARGET_LDFLAGS += -lgps
>>> +
>>> +define Build/Compile
>>> +       $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS)
>>> $(PKG_BUILD_DIR)/lgps.c -o $(PKG_BUILD_DIR)/gps.so
>>> +endef
>>> +
>>> +define Package/luagps/install
>>> +       $(INSTALL_DIR) $(1)/usr/lib/lua
>>> +       $(INSTALL_BIN) $(PKG_BUILD_DIR)/gps.so $(1)/usr/lib/lua/
>>> +endef
>>> +
>>> +$(eval $(call BuildPackage,luagps))
>>> diff --git
>>> a/lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch
>>> b/lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch
>>> new file mode 100644
>>> index 000..63a7f3d
>>> --- /dev/null
>>> +++ b/lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch
>>> @@ -0,0 +1,62 @@
>>> +--- a/lgps.c   2012-04-05 11:19:27.0 +0300
>>>  b/lgps.c   2012-04-05 12:28:17.0 +0300
>>> +@@ -30,7 +30,6 @@
>>> + static int
>>> + lgps_open (lua_State *L)
>>> + {
>>> +-  int top = lua_gettop (L);
>>> +   struct gps_data_t *ud = NULL;
>>> +   const char *server = luaL_checkstring (L, 1);
>>> +   const char *port = luaL_checkstring (L, 2);
>>> +@@ -39,8 +38,13 @@
>>> +   if (NULL == ud)
>>> +     print_error ("out of memory");
>>> +
>>> ++#if (GPSD_API_MAJOR_VERSION>  4)
>>> +   if (0 != gps_open (server, port, ud))
>>> +     print_error ("no gpsd running or network error: %d, %s", errno,
>>> gps_errstr (errno));
>>> ++#else
>>> ++  if (0 != gps_open_r (server, port, ud))
>>> ++    print_error ("no gpsd running or network error: %d, %s", errno,
>>> gps_errstr (errno));
>>> ++#endif
>>> +
>>> +   luaL_getmetatable (L, MT_GPS);
>>> +   lua_setmetatable (L, -2);
>>> +@@ -86,9 +90,13 @@
>>> + lgps_waiting (lua_State *L)
>>> + {
>>> +   struct gps_data_t *ud = luaL_checkudata (L, 1, MT_GPS);
>>> +-  lua_Integer timeout = luaL_checkinteger (L, 2);
>>> +
>>> ++#if (GP

Re: [OpenWrt-Devel] [PATCH] Add Lua bindings for libgps

2012-04-16 Thread Christian Gagneraud

On 05/04/12 16:19, Dave Taht wrote:

I note that I have been tracking the latest gpsds closely (with the new api)

A problem is that it requires that scons support be added to the
mainline openwrt build.

Got patches for all that, could use some more testing...


Hi Dave,

I'm interesting as well to see gpsd updated to the latest stable 
version, would you mind to share your patches? I'll be happy to give 
them a try!


Chris




On Thu, Apr 5, 2012 at 3:02 AM, Viktar Palstsiuk
  wrote:

Signed-off-by: Viktar Palstsiuk
---
  lang/luagps/Makefile   |   50 
  .../001-add_compatibility_with_old_gpsd_api.patch  |   62 
  2 files changed, 112 insertions(+), 0 deletions(-)
  create mode 100644 lang/luagps/Makefile
  create mode 100644 
lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch

diff --git a/lang/luagps/Makefile b/lang/luagps/Makefile
new file mode 100644
index 000..268e826
--- /dev/null
+++ b/lang/luagps/Makefile
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=luagps
+PKG_REV:=2d3dd6b1cc7b87891af19857bfedd2e1845d2e3b
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_REV).tar.bz2
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://github.com/jdegges/lua-gps.git
+PKG_SOURCE_VERSION:=$(PKG_REV)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/luagps
+  SUBMENU:=Lua
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Lua bindings for libgps
+  URL:=https://github.com/jdegges/lua-gps
+  DEPENDS:=+lua +gpsd
+endef
+
+define Package/luagps/description
+  Lua bindings for libgps.
+endef
+
+define Build/Configure
+endef
+
+TARGET_CFLAGS += $(FPIC) -shared -g -W -Wall -I$(STAGING_DIR)/usr/include/
+TARGET_LDFLAGS += -lgps
+
+define Build/Compile
+   $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(PKG_BUILD_DIR)/lgps.c 
-o $(PKG_BUILD_DIR)/gps.so
+endef
+
+define Package/luagps/install
+   $(INSTALL_DIR) $(1)/usr/lib/lua
+   $(INSTALL_BIN) $(PKG_BUILD_DIR)/gps.so $(1)/usr/lib/lua/
+endef
+
+$(eval $(call BuildPackage,luagps))
diff --git a/lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch 
b/lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch
new file mode 100644
index 000..63a7f3d
--- /dev/null
+++ b/lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch
@@ -0,0 +1,62 @@
+--- a/lgps.c   2012-04-05 11:19:27.0 +0300
 b/lgps.c   2012-04-05 12:28:17.0 +0300
+@@ -30,7 +30,6 @@
+ static int
+ lgps_open (lua_State *L)
+ {
+-  int top = lua_gettop (L);
+   struct gps_data_t *ud = NULL;
+   const char *server = luaL_checkstring (L, 1);
+   const char *port = luaL_checkstring (L, 2);
+@@ -39,8 +38,13 @@
+   if (NULL == ud)
+ print_error ("out of memory");
+
++#if (GPSD_API_MAJOR_VERSION>  4)
+   if (0 != gps_open (server, port, ud))
+ print_error ("no gpsd running or network error: %d, %s", errno, 
gps_errstr (errno));
++#else
++  if (0 != gps_open_r (server, port, ud))
++print_error ("no gpsd running or network error: %d, %s", errno, 
gps_errstr (errno));
++#endif
+
+   luaL_getmetatable (L, MT_GPS);
+   lua_setmetatable (L, -2);
+@@ -86,9 +90,13 @@
+ lgps_waiting (lua_State *L)
+ {
+   struct gps_data_t *ud = luaL_checkudata (L, 1, MT_GPS);
+-  lua_Integer timeout = luaL_checkinteger (L, 2);
+
++#if (GPSD_API_MAJOR_VERSION>  4)
++  lua_Integer timeout = luaL_checkinteger (L, 2);
+   lua_pushboolean (L, gps_waiting (ud, timeout));
++#else
++  lua_pushboolean (L, gps_waiting (ud));
++#endif
+
+   return 1;
+ }
+@@ -108,7 +116,12 @@
+   int count;
+   int i;
+
++#if (GPSD_API_MAJOR_VERSION>  4)
+   count = gps_read (ud);
++#else
++  count = gps_poll (ud) + 1;
++#endif
++
+   if (count<= 0)
+ print_error ("either no data or error reading data");
+
+@@ -247,7 +260,9 @@
+   SET_CONST_INT (WATCH_RARE);
+   SET_CONST_INT (WATCH_RAW);
+   SET_CONST_INT (WATCH_SCALED);
++#if (GPSD_API_MAJOR_VERSION>  4)
+   SET_CONST_INT (WATCH_TIMING);
++#endif
+   SET_CONST_INT (WATCH_DEVICE);
+   SET_CONST_INT (WATCH_NEWSTYLE);
+   SET_CONST_INT (WATCH_OLDSTYLE);
--
1.7.9.1

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel







--
Christian Gagneraud,
Embedded systems engineer.
Techworks Marine
1 Harbour road
Dun Laoghaire
Co. Dublin
Ireland
Tel: + 353 (0) 1 236 5990
Web: http://www.techworks.ie/
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] Add Lua bindings for libgps

2012-04-05 Thread Dave Taht
I note that I have been tracking the latest gpsds closely (with the new api)

A problem is that it requires that scons support be added to the
mainline openwrt build.

Got patches for all that, could use some more testing...

On Thu, Apr 5, 2012 at 3:02 AM, Viktar Palstsiuk
 wrote:
> Signed-off-by: Viktar Palstsiuk 
> ---
>  lang/luagps/Makefile                               |   50 
>  .../001-add_compatibility_with_old_gpsd_api.patch  |   62 
> 
>  2 files changed, 112 insertions(+), 0 deletions(-)
>  create mode 100644 lang/luagps/Makefile
>  create mode 100644 
> lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch
>
> diff --git a/lang/luagps/Makefile b/lang/luagps/Makefile
> new file mode 100644
> index 000..268e826
> --- /dev/null
> +++ b/lang/luagps/Makefile
> @@ -0,0 +1,50 @@
> +#
> +# Copyright (C) 2012 OpenWrt.org
> +#
> +# This is free software, licensed under the GNU General Public License v2.
> +# See /LICENSE for more information.
> +#
> +
> +include $(TOPDIR)/rules.mk
> +
> +PKG_NAME:=luagps
> +PKG_REV:=2d3dd6b1cc7b87891af19857bfedd2e1845d2e3b
> +PKG_RELEASE:=1
> +
> +PKG_SOURCE:=$(PKG_NAME)-$(PKG_REV).tar.bz2
> +PKG_SOURCE_SUBDIR:=$(PKG_NAME)
> +PKG_SOURCE_PROTO:=git
> +PKG_SOURCE_URL:=git://github.com/jdegges/lua-gps.git
> +PKG_SOURCE_VERSION:=$(PKG_REV)
> +
> +include $(INCLUDE_DIR)/package.mk
> +
> +define Package/luagps
> +  SUBMENU:=Lua
> +  SECTION:=lang
> +  CATEGORY:=Languages
> +  TITLE:=Lua bindings for libgps
> +  URL:=https://github.com/jdegges/lua-gps
> +  DEPENDS:=+lua +gpsd
> +endef
> +
> +define Package/luagps/description
> +  Lua bindings for libgps.
> +endef
> +
> +define Build/Configure
> +endef
> +
> +TARGET_CFLAGS += $(FPIC) -shared -g -W -Wall -I$(STAGING_DIR)/usr/include/
> +TARGET_LDFLAGS += -lgps
> +
> +define Build/Compile
> +       $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) 
> $(PKG_BUILD_DIR)/lgps.c -o $(PKG_BUILD_DIR)/gps.so
> +endef
> +
> +define Package/luagps/install
> +       $(INSTALL_DIR) $(1)/usr/lib/lua
> +       $(INSTALL_BIN) $(PKG_BUILD_DIR)/gps.so $(1)/usr/lib/lua/
> +endef
> +
> +$(eval $(call BuildPackage,luagps))
> diff --git 
> a/lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch 
> b/lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch
> new file mode 100644
> index 000..63a7f3d
> --- /dev/null
> +++ b/lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch
> @@ -0,0 +1,62 @@
> +--- a/lgps.c   2012-04-05 11:19:27.0 +0300
>  b/lgps.c   2012-04-05 12:28:17.0 +0300
> +@@ -30,7 +30,6 @@
> + static int
> + lgps_open (lua_State *L)
> + {
> +-  int top = lua_gettop (L);
> +   struct gps_data_t *ud = NULL;
> +   const char *server = luaL_checkstring (L, 1);
> +   const char *port = luaL_checkstring (L, 2);
> +@@ -39,8 +38,13 @@
> +   if (NULL == ud)
> +     print_error ("out of memory");
> +
> ++#if (GPSD_API_MAJOR_VERSION > 4)
> +   if (0 != gps_open (server, port, ud))
> +     print_error ("no gpsd running or network error: %d, %s", errno, 
> gps_errstr (errno));
> ++#else
> ++  if (0 != gps_open_r (server, port, ud))
> ++    print_error ("no gpsd running or network error: %d, %s", errno, 
> gps_errstr (errno));
> ++#endif
> +
> +   luaL_getmetatable (L, MT_GPS);
> +   lua_setmetatable (L, -2);
> +@@ -86,9 +90,13 @@
> + lgps_waiting (lua_State *L)
> + {
> +   struct gps_data_t *ud = luaL_checkudata (L, 1, MT_GPS);
> +-  lua_Integer timeout = luaL_checkinteger (L, 2);
> +
> ++#if (GPSD_API_MAJOR_VERSION > 4)
> ++  lua_Integer timeout = luaL_checkinteger (L, 2);
> +   lua_pushboolean (L, gps_waiting (ud, timeout));
> ++#else
> ++  lua_pushboolean (L, gps_waiting (ud));
> ++#endif
> +
> +   return 1;
> + }
> +@@ -108,7 +116,12 @@
> +   int count;
> +   int i;
> +
> ++#if (GPSD_API_MAJOR_VERSION > 4)
> +   count = gps_read (ud);
> ++#else
> ++  count = gps_poll (ud) + 1;
> ++#endif
> ++
> +   if (count <= 0)
> +     print_error ("either no data or error reading data");
> +
> +@@ -247,7 +260,9 @@
> +   SET_CONST_INT (WATCH_RARE);
> +   SET_CONST_INT (WATCH_RAW);
> +   SET_CONST_INT (WATCH_SCALED);
> ++#if (GPSD_API_MAJOR_VERSION > 4)
> +   SET_CONST_INT (WATCH_TIMING);
> ++#endif
> +   SET_CONST_INT (WATCH_DEVICE);
> +   SET_CONST_INT (WATCH_NEWSTYLE);
> +   SET_CONST_INT (WATCH_OLDSTYLE);
> --
> 1.7.9.1
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



-- 
Dave Täht
SKYPE: davetaht
US Tel: 1-239-829-5608
http://www.bufferbloat.net
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] Add Lua bindings for libgps

2012-04-05 Thread Viktar Palstsiuk
Signed-off-by: Viktar Palstsiuk 
---
 lang/luagps/Makefile   |   50 
 .../001-add_compatibility_with_old_gpsd_api.patch  |   62 
 2 files changed, 112 insertions(+), 0 deletions(-)
 create mode 100644 lang/luagps/Makefile
 create mode 100644 
lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch

diff --git a/lang/luagps/Makefile b/lang/luagps/Makefile
new file mode 100644
index 000..268e826
--- /dev/null
+++ b/lang/luagps/Makefile
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=luagps
+PKG_REV:=2d3dd6b1cc7b87891af19857bfedd2e1845d2e3b
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_REV).tar.bz2
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://github.com/jdegges/lua-gps.git
+PKG_SOURCE_VERSION:=$(PKG_REV)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/luagps
+  SUBMENU:=Lua
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Lua bindings for libgps
+  URL:=https://github.com/jdegges/lua-gps
+  DEPENDS:=+lua +gpsd
+endef
+
+define Package/luagps/description
+  Lua bindings for libgps.
+endef
+
+define Build/Configure
+endef
+
+TARGET_CFLAGS += $(FPIC) -shared -g -W -Wall -I$(STAGING_DIR)/usr/include/
+TARGET_LDFLAGS += -lgps
+
+define Build/Compile
+   $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(PKG_BUILD_DIR)/lgps.c 
-o $(PKG_BUILD_DIR)/gps.so
+endef
+
+define Package/luagps/install
+   $(INSTALL_DIR) $(1)/usr/lib/lua
+   $(INSTALL_BIN) $(PKG_BUILD_DIR)/gps.so $(1)/usr/lib/lua/
+endef
+
+$(eval $(call BuildPackage,luagps))
diff --git a/lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch 
b/lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch
new file mode 100644
index 000..63a7f3d
--- /dev/null
+++ b/lang/luagps/patches/001-add_compatibility_with_old_gpsd_api.patch
@@ -0,0 +1,62 @@
+--- a/lgps.c   2012-04-05 11:19:27.0 +0300
 b/lgps.c   2012-04-05 12:28:17.0 +0300
+@@ -30,7 +30,6 @@
+ static int
+ lgps_open (lua_State *L)
+ {
+-  int top = lua_gettop (L);
+   struct gps_data_t *ud = NULL;
+   const char *server = luaL_checkstring (L, 1);
+   const char *port = luaL_checkstring (L, 2);
+@@ -39,8 +38,13 @@
+   if (NULL == ud)
+ print_error ("out of memory");
+ 
++#if (GPSD_API_MAJOR_VERSION > 4)
+   if (0 != gps_open (server, port, ud))
+ print_error ("no gpsd running or network error: %d, %s", errno, 
gps_errstr (errno));
++#else
++  if (0 != gps_open_r (server, port, ud))
++print_error ("no gpsd running or network error: %d, %s", errno, 
gps_errstr (errno));
++#endif
+ 
+   luaL_getmetatable (L, MT_GPS);
+   lua_setmetatable (L, -2);
+@@ -86,9 +90,13 @@
+ lgps_waiting (lua_State *L)
+ {
+   struct gps_data_t *ud = luaL_checkudata (L, 1, MT_GPS);
+-  lua_Integer timeout = luaL_checkinteger (L, 2);
+ 
++#if (GPSD_API_MAJOR_VERSION > 4)
++  lua_Integer timeout = luaL_checkinteger (L, 2);
+   lua_pushboolean (L, gps_waiting (ud, timeout));
++#else
++  lua_pushboolean (L, gps_waiting (ud));
++#endif
+ 
+   return 1;
+ }
+@@ -108,7 +116,12 @@
+   int count;
+   int i;
+ 
++#if (GPSD_API_MAJOR_VERSION > 4)  
+   count = gps_read (ud);
++#else
++  count = gps_poll (ud) + 1;
++#endif
++  
+   if (count <= 0)
+ print_error ("either no data or error reading data");
+ 
+@@ -247,7 +260,9 @@
+   SET_CONST_INT (WATCH_RARE);
+   SET_CONST_INT (WATCH_RAW);
+   SET_CONST_INT (WATCH_SCALED);
++#if (GPSD_API_MAJOR_VERSION > 4)
+   SET_CONST_INT (WATCH_TIMING);
++#endif
+   SET_CONST_INT (WATCH_DEVICE);
+   SET_CONST_INT (WATCH_NEWSTYLE);
+   SET_CONST_INT (WATCH_OLDSTYLE);
-- 
1.7.9.1

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel