ccrypt: moved to github
ccrypt: moved to github

git-svn-id: svn://svn.openwrt.org/openwrt/packages@41784 3c298f89-4303-0410-b956-a3cf2f4a3e73

file:a/lang/luaexpat/Makefile (deleted)
#  
# Copyright (C) 2009 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:=luaexpat  
PKG_VERSION:=1.1  
PKG_RELEASE:=2  
 
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz  
PKG_SOURCE_URL:=http://luaforge.net/frs/download.php/2469  
PKG_MD5SUM:=6ecb895ccf5cff1e7f2facd438b1f8d0  
 
include $(INCLUDE_DIR)/package.mk  
 
define Package/luaexpat  
SUBMENU:=Lua  
SECTION:=lang  
CATEGORY:=Languages  
TITLE:=LuaExpat  
URL:=http://www.keplerproject.org/luaexpat/  
DEPENDS:=+lua +libexpat  
endef  
 
define Package/luaexpat/description  
LuaExpat is a SAX XML parser based on the Expat library.  
endef  
 
define Build/Configure  
endef  
 
define Build/Compile  
$(CP) files/compat-5.1r5 $(PKG_BUILD_DIR)/compat-5.1r5  
$(MAKE) -C $(PKG_BUILD_DIR) \  
EXPAT_INC="$(STAGING_DIR)/usr/include/" \  
LUA_INC="$(STAGING_DIR)/usr/include/" \  
LUA_LIBDIR="$(STAGING_DIR)/usr/lib/" \  
COMPAT_DIR="$(PKG_BUILD_DIR)/compat-5.1r5" \  
LIB_OPTION="-shared $(TARGET_LDFLAGS)" \  
CC="$(TARGET_CC) $(TARGET_CFLAGS) $(FPIC) -std=c99" \  
LD="$(TARGET_CROSS)ld -shared"  
endef  
 
define Package/luaexpat/install  
$(INSTALL_DIR) $(1)/usr/lib/lua  
$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/lxp.so.1.1.0 $(1)/usr/lib/lua/lxp.so  
$(INSTALL_DIR) $(1)/usr/lib/lua/lxp  
$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/lxp/lom.lua $(1)/usr/lib/lua/lxp  
endef  
 
$(eval $(call BuildPackage,luaexpat))  
 
/*  
** Compat-5.1  
** Copyright Kepler Project 2004-2006 (http://www.keplerproject.org/compat)  
** $Id: compat-5.1.c,v 1.13 2006/02/20 21:12:47 carregal Exp $  
*/  
 
#include <stdio.h>  
#include <string.h>  
#include "lua.h"  
#include "lauxlib.h"  
#include "compat-5.1.h"  
 
static void getfield(lua_State *L, int idx, const char *name) {  
const char *end = strchr(name, '.');  
lua_pushvalue(L, idx);  
while (end) {  
lua_pushlstring(L, name, end - name);  
lua_gettable(L, -2);  
lua_remove(L, -2);  
if (lua_isnil(L, -1)) return;  
name = end+1;  
end = strchr(name, '.');  
}  
lua_pushstring(L, name);  
lua_gettable(L, -2);  
lua_remove(L, -2);  
}  
 
static void setfield(lua_State *L, int idx, const char *name) {  
const char *end = strchr(name, '.');  
lua_pushvalue(L, idx);  
while (end) {  
lua_pushlstring(L, name, end - name);  
lua_gettable(L, -2);  
/* create table if not found */  
if (lua_isnil(L, -1)) {  
lua_pop(L, 1);  
lua_newtable(L);  
lua_pushlstring(L, name, end - name);  
lua_pushvalue(L, -2);  
lua_settable(L, -4);  
}  
lua_remove(L, -2);  
name = end+1;  
end = strchr(name, '.');  
}  
lua_pushstring(L, name);  
lua_pushvalue(L, -3);  
lua_settable(L, -3);  
lua_pop(L, 2);  
}  
 
LUALIB_API void luaL_module(lua_State *L, const char *libname,  
const luaL_reg *l, int nup) {  
if (libname) {  
getfield(L, LUA_GLOBALSINDEX, libname); /* check whether lib already exists */  
if (lua_isnil(L, -1)) {  
int env, ns;  
lua_pop(L, 1); /* get rid of nil */  
lua_pushliteral(L, "require");  
lua_gettable(L, LUA_GLOBALSINDEX); /* look for require */  
lua_getfenv(L, -1); /* getfenv(require) */  
lua_remove(L, -2); /* remove function require */  
env = lua_gettop(L);  
 
lua_newtable(L); /* create namespace for lib */  
ns = lua_gettop(L);  
getfield(L, env, "package.loaded"); /* get package.loaded table */  
if (lua_isnil(L, -1)) { /* create package.loaded table */  
lua_pop(L, 1); /* remove previous result */  
lua_newtable(L);  
lua_pushvalue(L, -1);  
setfield(L, env, "package.loaded");  
}  
else if (!lua_istable(L, -1))  
luaL_error(L, "name conflict for library `%s'", libname);  
lua_pushstring(L, libname);  
lua_pushvalue(L, ns);  
lua_settable(L, -3); /* package.loaded[libname] = ns */  
lua_pop(L, 1); /* get rid of package.loaded table */  
lua_pushvalue(L, ns); /* copy namespace */  
setfield(L, LUA_GLOBALSINDEX, libname);  
lua_remove (L, env); /* remove env */  
}  
lua_insert(L, -(nup+1)); /* move library table to below upvalues */  
}  
for (; l->name; l++) {  
int i;  
lua_pushstring(L, l->name);  
for (i=0; i<nup; i++) /* copy upvalues to the top */  
lua_pushvalue(L, -(nup+1));  
lua_pushcclosure(L, l->func, nup);  
lua_settable(L, -(nup+3));  
}  
lua_pop(L, nup); /* remove upvalues */  
}  
 
 
/*  
** Compat-5.1  
** Copyright Kepler Project 2004-2006 (http://www.keplerproject.org/compat/)  
** $Id: compat-5.1.h,v 1.8 2006/02/20 21:12:47 carregal Exp $  
*/  
 
#ifndef COMPAT_H  
 
LUALIB_API void luaL_module(lua_State *L, const char *libname,  
const luaL_reg *l, int nup);  
#define luaL_openlib luaL_module  
 
#endif  
 
--  
-- Compat-5.1  
-- Copyright Kepler Project 2004-2006 (http://www.keplerproject.org/compat)  
-- According to Lua 5.1  
-- $Id: compat-5.1.lua,v 1.22 2006/02/20 21:12:47 carregal Exp $  
--  
 
_COMPAT51 = "Compat-5.1 R5"  
 
local LUA_DIRSEP = '/'  
local LUA_OFSEP = '_'  
local OLD_LUA_OFSEP = ''  
local POF = 'luaopen_'  
local LUA_PATH_MARK = '?'  
local LUA_IGMARK = ':'  
 
local assert, error, getfenv, ipairs, loadfile, loadlib, pairs, setfenv, setmetatable, type = assert, error, getfenv, ipairs, loadfile, loadlib, pairs, setfenv, setmetatable, type  
local find, format, gfind, gsub, sub = string.find, string.format, string.gfind, string.gsub, string.sub  
 
--  
-- avoid overwriting the package table if it's already there  
--  
package = package or {}  
local _PACKAGE = package  
 
package.path = LUA_PATH or os.getenv("LUA_PATH") or  
("./?.lua;" ..  
"/usr/local/share/lua/5.0/?.lua;" ..  
"/usr/local/share/lua/5.0/?/?.lua;" ..  
"/usr/local/share/lua/5.0/?/init.lua" )  
 
package.cpath = LUA_CPATH or os.getenv("LUA_CPATH") or  
"./?.so;" ..  
"./l?.so;" ..  
"/usr/local/lib/lua/5.0/?.so;" ..  
"/usr/local/lib/lua/5.0/l?.so"  
 
--  
-- make sure require works with standard libraries  
--  
package.loaded = package.loaded or {}  
package.loaded.debug = debug  
package.loaded.string = string  
package.loaded.math = math  
package.loaded.io = io  
package.loaded.os = os  
package.loaded.table = table  
package.loaded.base = _G  
package.loaded.coroutine = coroutine  
local _LOADED = package.loaded  
 
--  
-- avoid overwriting the package.preload table if it's already there  
--  
package.preload = package.preload or {}  
local _PRELOAD = package.preload  
 
 
--  
-- looks for a file `name' in given path  
--  
local function findfile (name, pname)  
name = gsub (name, "%.", LUA_DIRSEP)  
local path = _PACKAGE[pname]  
assert (type(path) == "string", format ("package.%s must be a string", pname))  
for c in gfind (path, "[^;]+") do  
c = gsub (c, "%"..LUA_PATH_MARK, name)  
local f = io.open (c)  
if f then  
f:close ()  
return c  
end  
end  
return nil -- not found  
end  
 
 
--  
-- check whether library is already loaded  
--  
local function loader_preload (name)  
assert (type(name) == "string", format (  
"bad argument #1 to `require' (string expected, got %s)", type(name)))  
assert (type(_PRELOAD) == "table", "`package.preload' must be a table")  
return _PRELOAD[name]  
end  
 
 
--  
-- Lua library loader  
--  
local function loader_Lua (name)  
assert (type(name) == "string", format (  
"bad argument #1 to `require' (string expected, got %s)", type(name)))  
local filename = findfile (name, "path")  
if not filename then  
return false  
end  
local f, err = loadfile (filename)  
if not f then  
error (format ("error loading module `%s' (%s)", name, err))  
end  
return f  
end  
 
 
local function mkfuncname (name)  
name = gsub (name, "^.*%"..LUA_IGMARK, "")  
name = gsub (name, "%.", LUA_OFSEP)  
return POF..name  
end  
 
local function old_mkfuncname (name)  
--name = gsub (name, "^.*%"..LUA_IGMARK, "")  
name = gsub (name, "%.", OLD_LUA_OFSEP)  
return POF..name  
end  
 
--  
-- C library loader  
--  
local function loader_C (name)  
assert (type(name) == "string", format (  
"bad argument #1 to `require' (string expected, got %s)", type(name)))  
local filename = findfile (name, "cpath")  
if not filename then  
return false  
end  
local funcname = mkfuncname (name)  
local f, err = loadlib (filename, funcname)  
if not f then  
funcname = old_mkfuncname (name)  
f, err = loadlib (filename, funcname)  
if not f then  
error (format ("error loading module `%s' (%s)", name, err))  
end  
end  
return f  
end  
 
 
local function loader_Croot (name)  
local p = gsub (name, "^([^.]*).-$", "%1")  
if p == "" then  
return  
end  
local filename = findfile (p, "cpath")  
if not filename then  
return  
end  
local funcname = mkfuncname (name)  
local f, err, where = loadlib (filename, funcname)  
if f then  
return f  
elseif where ~= "init" then  
error (format ("error loading module `%s' (%s)", name, err))  
end  
end  
 
-- create `loaders' table  
package.loaders = package.loaders or { loader_preload, loader_Lua, loader_C, loader_Croot, }  
local _LOADERS = package.loaders  
 
 
--  
-- iterate over available loaders  
--  
local function load (name, loaders)  
-- iterate over available loaders  
assert (type (loaders) == "table", "`package.loaders' must be a table")  
for i, loader in ipairs (loaders) do  
local f = loader (name)  
if f then  
return f  
end  
end  
error (format ("module `%s' not found", name))  
end  
 
-- sentinel  
local sentinel = function () end  
 
--  
-- new require  
--  
function _G.require (modname)  
assert (type(modname) == "string", format (  
"bad argument #1 to `require' (string expected, got %s)", type(name)))  
local p = _LOADED[modname]  
if p then -- is it there?  
if p == sentinel then  
error (format ("loop or previous error loading module '%s'", modname))  
end  
return p -- package is already loaded  
end  
local init = load (modname, _LOADERS)  
_LOADED[modname] = sentinel  
local actual_arg = _G.arg  
_G.arg = { modname }  
local res = init (modname)  
if res then  
_LOADED[modname] = res  
end  
_G.arg = actual_arg  
if _LOADED[modname] == sentinel then  
_LOADED[modname] = true  
end  
return _LOADED[modname]  
end  
 
 
-- findtable  
local function findtable (t, f)  
assert (type(f)=="string", "not a valid field name ("..tostring(f)..")")  
local ff = f.."."  
local ok, e, w = find (ff, '(.-)%.', 1)  
while ok do  
local nt = rawget (t, w)  
if not nt then  
nt = {}  
t[w] = nt  
elseif type(t) ~= "table" then  
return sub (f, e+1)  
end  
t = nt  
ok, e, w = find (ff, '(.-)%.', e+1)  
end  
return t  
end  
 
--  
-- new package.seeall function  
--  
function _PACKAGE.seeall (module)  
local t = type(module)  
assert (t == "table", "bad argument #1 to package.seeall (table expected, got "..t..")")  
local meta = getmetatable (module)  
if not meta then  
meta = {}  
setmetatable (module, meta)  
end  
meta.__index = _G  
end  
 
 
--  
-- new module function  
--  
function _G.module (modname, ...)  
local ns = _LOADED[modname]  
if type(ns) ~= "table" then  
ns = findtable (_G, modname)  
if not ns then  
error (string.format ("name conflict for module '%s'", modname))  
end  
_LOADED[modname] = ns  
end  
if not ns._NAME then  
ns._NAME = modname  
ns._M = ns  
ns._PACKAGE = gsub (modname, "[^.]*$", "")  
end  
setfenv (2, ns)  
for i, f in ipairs (arg) do  
f (ns)  
end  
end  
 
--- a/config  
+++ b/config  
@@ -31,6 +31,6 @@  
-Wshadow \  
-Wwrite-strings  
 
-CFLAGS = $(CWARNS) -ansi -O2 -I$(LUA_INC) \  
+CFLAGS = $(CWARNS) -O2 -I$(LUA_INC) \  
-I$(COMPAT_DIR) -I$(EXPAT_INC)  
CC = gcc  
 
#  
# Copyright (C) 2008-2010 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:=luafilesystem  
PKG_VERSION:=1.6.2  
PKG_RELEASE:=1  
 
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz  
PKG_SOURCE_URL:=https://github.com/keplerproject/luafilesystem.git  
PKG_SOURCE_VERSION:=2fd989cd6c777583be1c93616018c55b2cbb1bcf  
PKG_SOURCE_PROTO:=git  
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)  
 
include $(INCLUDE_DIR)/package.mk  
 
define Package/luafilesystem  
SUBMENU:=Lua  
SECTION:=lang  
CATEGORY:=Languages  
TITLE:=LuaFileSystem  
URL:=http://keplerproject.github.com/luafilesystem/  
DEPENDS:=+liblua  
endef  
 
define Package/luafilesystem/description  
This package contains the LuaFileSystem library, a set of portable  
functions for directory creation, listing and deletion and for file  
locking.  
endef  
 
define Build/Configure  
endef  
 
TARGET_CFLAGS += $(FPIC) $(TARGET_CPPFLAGS)  
 
TARGET_LDFLAGS += -llua  
 
define Build/Compile  
$(MAKE) -C $(PKG_BUILD_DIR) \  
$(TARGET_CONFIGURE_OPTS) \  
CFLAGS="$(TARGET_CFLAGS) -std=gnu99" \  
LDFLAGS="$(TARGET_LDFLAGS)"  
$(TARGET_CROSS)ar r $(PKG_BUILD_DIR)/src/luafilesystem.a $(PKG_BUILD_DIR)/src/lfs.o  
endef  
 
define Build/InstallDev  
$(INSTALL_DIR) $(STAGING_DIR)/usr/include  
$(INSTALL_DIR) $(STAGING_DIR)/usr/lib/lua  
$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/lfs.h $(STAGING_DIR)/usr/include  
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/lfs.so $(STAGING_DIR)/usr/lib/lua  
$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/luafilesystem.a $(STAGING_DIR)/usr/lib/lua  
endef  
 
define Package/luafilesystem/install  
$(INSTALL_DIR) $(1)/usr/lib/lua  
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/lfs.so $(1)/usr/lib/lua/lfs.so  
endef  
 
$(eval $(call BuildPackage,luafilesystem))  
 
file:a/lang/luasec/Makefile (deleted)
#  
# Copyright (C) 2009-2010 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:=luasec  
PKG_VERSION:=0.4  
PKG_RELEASE:=1  
 
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz  
PKG_SOURCE_URL:=http://luaforge.net/frs/download.php/4255  
PKG_MD5SUM:=712158d60207bdbb6215fc7e07d8db24  
 
PKG_INSTALL:=1  
 
include $(INCLUDE_DIR)/package.mk  
 
define Package/luasec  
SUBMENU:=Lua  
SECTION:=lang  
CATEGORY:=Languages  
TITLE:=LuaSec  
URL:=http://luasec.luaforge.net/  
DEPENDS:=+lua +libopenssl +luasocket  
endef  
 
define Package/luasec/description  
LuaSec is a binding for OpenSSL library to provide TLS/SSL communication.  
endef  
 
define Build/Configure  
endef  
 
MAKE_PATH = ./src  
 
MAKE_FLAGS += \  
INCDIR="$(TARGET_CPPFLAGS)" \  
LIBDIR="$(TARGET_LDFLAGS)" \  
CC="$(TARGET_CC) $(TARGET_CFLAGS) -std=gnu99" \  
LD="$(TARGET_CROSS)ld -shared" \  
LUACPATH="$(PKG_INSTALL_DIR)/usr/lib/lua" \  
LUAPATH="$(PKG_INSTALL_DIR)/usr/lib/lua" \  
linux \  
 
define Package/luasec/install  
$(INSTALL_DIR) $(1)/usr/lib/lua  
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/ssl.so $(1)/usr/lib/lua/  
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/ssl.lua $(1)/usr/lib/lua/  
$(INSTALL_DIR) $(1)/usr/lib/lua/ssl  
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/ssl/https.lua $(1)/usr/lib/lua/ssl/  
endef  
 
$(eval $(call BuildPackage,luasec))  
 
file:a/lang/luasocket/Makefile (deleted)
#  
# Copyright (C) 2009-2013 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:=luasocket  
PKG_SOURCE_VERSION:=6d5e40c324c84d9c1453ae88e0ad5bdd0a631448  
PKG_VERSION:=3.0-rc1-20130909  
PKG_RELEASE:=2  
 
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2  
PKG_SOURCE_URL:=https://github.com/diegonehab/luasocket.git  
PKG_SOURCE_PROTO:=git  
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)  
 
include $(INCLUDE_DIR)/package.mk  
 
define Package/luasocket  
SUBMENU:=Lua  
SECTION:=lang  
CATEGORY:=Languages  
TITLE:=LuaSocket  
URL:=http://luasocket.luaforge.net/  
DEPENDS:=+lua  
endef  
 
define Package/luasocket/description  
LuaSocket is the most comprehensive networking support  
library for the Lua language. It provides easy access to  
TCP, UDP, DNS, SMTP, FTP, HTTP, MIME and much more.  
endef  
 
define Build/Configure  
endef  
 
define Build/Compile  
$(MAKE) -C $(PKG_BUILD_DIR)/ \  
LIBDIR="$(TARGET_LDFLAGS)" \  
CC="$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -std=gnu99" \  
LD="$(TARGET_CROSS)ld -shared" \  
all  
endef  
 
 
define Package/luasocket/install  
$(INSTALL_DIR) $(1)/usr/lib/lua  
$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/{ltn12,mime,socket}.lua $(1)/usr/lib/lua  
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mime.so.1.0.3 $(1)/usr/lib/lua  
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/socket.so.3.0-rc1 $(1)/usr/lib/lua  
$(INSTALL_DIR) $(1)/usr/lib/lua/mime  
ln -sf ../mime.so.1.0.3 $(1)/usr/lib/lua/mime/core.so  
$(INSTALL_DIR) $(1)/usr/lib/lua/socket  
$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/{ftp,http,smtp,tp,url,headers}.lua $(1)/usr/lib/lua/socket  
ln -sf ../socket.so.3.0-rc1 $(1)/usr/lib/lua/socket/core.so  
endef  
 
$(eval $(call BuildPackage,luasocket))  
 
From 96fdf07acf78ecfc9be76a8b0591f38fe6f1a875 Mon Sep 17 00:00:00 2001  
From: Steven Barth <steven@midlink.org>  
Date: Sat, 9 Nov 2013 12:01:42 +0100  
Subject: [PATCH] Add interface resolving  
 
---  
src/if.c | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
src/if.h | 27 ++++++++++++++  
src/luasocket.c | 2 +  
src/makefile | 2 +  
src/options.c | 9 +++++  
5 files changed, 153 insertions(+)  
create mode 100644 src/if.c  
create mode 100644 src/if.h  
 
diff --git a/src/if.c b/src/if.c  
new file mode 100644  
index 0000000..db231aa  
--- /dev/null  
+++ b/src/if.c  
@@ -0,0 +1,113 @@  
+/*  
+ * $Id: if.c $  
+ *  
+ * Author: Markus Stenberg <fingon@iki.fi>  
+ *  
+ * Copyright (c) 2012 cisco Systems, Inc.  
+ *  
+ * Created: Tue Dec 4 14:50:34 2012 mstenber  
+ * Last modified: Wed Dec 5 18:51:08 2012 mstenber  
+ * Edit time: 24 min  
+ *  
+ */  
+  
+#include <sys/types.h>  
+#include <sys/socket.h>  
+#include <net/if.h>  
+  
+#include "if.h"  
+  
+#include "lauxlib.h"  
+  
+static int if_global_indextoname(lua_State *L);  
+static int if_global_nametoindex(lua_State *L);  
+static int if_global_nameindex(lua_State *L);  
+  
+static luaL_Reg func[] = {  
+ { "indextoname", if_global_indextoname},  
+ { "nametoindex", if_global_nametoindex},  
+ { "nameindex", if_global_nameindex},  
+ { NULL, NULL}  
+};  
+  
+int if_open(lua_State *L)  
+{  
+ lua_pushstring(L, "iface");  
+ lua_newtable(L);  
+ luaL_openlib(L, NULL, func, 0);  
+ lua_settable(L, -3);  
+ return 0;  
+}  
+  
+int if_global_indextoname(lua_State *L)  
+{  
+ unsigned int ifnumber;  
+ const char *name;  
+ char buf[IF_NAMESIZE+1];  
+  
+ if (!lua_isnumber(L, 1))  
+ {  
+ lua_pushnil(L);  
+ lua_pushstring(L, "indextoname expects only number argument");  
+ return 2;  
+ }  
+ ifnumber = lua_tonumber(L, 1);  
+ if (!(name = if_indextoname(ifnumber, buf)))  
+ {  
+ lua_pushnil(L);  
+ lua_pushstring(L, "nonexistent interface");  
+ return 2;  
+ }  
+ lua_pushstring(L, name);  
+ return 1;  
+}  
+  
+int if_global_nametoindex(lua_State *L)  
+{  
+ unsigned int ifnumber;  
+ if (!lua_isstring(L, 1))  
+ {  
+ lua_pushnil(L);  
+ lua_pushstring(L, "nametoindex expects only string argument");  
+ return 2;  
+ }  
+ if (!(ifnumber = if_nametoindex(lua_tostring(L, 1))))  
+ {  
+ lua_pushnil(L);  
+ lua_pushstring(L, "nonexistent interface");  
+ return 2;  
+ }  
+ lua_pushnumber(L, ifnumber);  
+ return 1;  
+}  
+  
+int if_global_nameindex(lua_State *L)  
+{  
+ struct if_nameindex *ni, *oni;  
+ int i = 1;  
+ oni = ni = if_nameindex();  
+ lua_newtable(L);  
+ while (ni && ni->if_index && *(ni->if_name))  
+ {  
+ /* at result[i], we store.. */  
+ lua_pushnumber(L, i);  
+  
+ /* new table with two items - index, name*/  
+ lua_newtable(L);  
+ lua_pushstring(L, "index");  
+ lua_pushnumber(L, ni->if_index);  
+ lua_settable(L, -3);  
+  
+ lua_pushstring(L, "name");  
+ lua_pushstring(L, ni->if_name);  
+ lua_settable(L, -3);  
+  
+ /* Then, actually store it */  
+ lua_settable(L, -3);  
+  
+ i++;  
+ ni++;  
+ }  
+ if_freenameindex(oni);  
+ return 1;  
+}  
diff --git a/src/if.h b/src/if.h  
new file mode 100644  
index 0000000..dc7faf8  
--- /dev/null  
+++ b/src/if.h  
@@ -0,0 +1,27 @@  
+/*  
+ * $Id: if.h $  
+ *  
+ * Author: Markus Stenberg <fingon@iki.fi>  
+ *  
+ * Copyright (c) 2012 cisco Systems, Inc.  
+ *  
+ * Created: Tue Dec 4 14:37:24 2012 mstenber  
+ * Last modified: Tue Dec 4 14:51:43 2012 mstenber  
+ * Edit time: 7 min  
+ *  
+ */  
+  
+/* This module provides Lua wrapping for the advanced socket API  
+ * defined in RFC3542, or mainly, the access to the system's interface  
+ * list. It is necessary for use of recvmsg/sendmsg.  
+ *  
+ * TODO - Do something clever with Windows?  
+ */  
+#ifndef IF_H  
+#define IF_H  
+  
+#include "lua.h"  
+  
+int if_open(lua_State *L);  
+  
+#endif /* IF_H */  
diff --git a/src/luasocket.c b/src/luasocket.c  
index e6ee747..85d41a6 100644  
--- a/src/luasocket.c  
+++ b/src/luasocket.c  
@@ -31,6 +31,7 @@  
#include "tcp.h"  
#include "udp.h"  
#include "select.h"  
+#include "if.h"  
 
/*-------------------------------------------------------------------------*\  
* Internal function prototypes  
@@ -51,6 +52,7 @@ static const luaL_Reg mod[] = {  
{"tcp", tcp_open},  
{"udp", udp_open},  
{"select", select_open},  
+ {"iface", if_open},  
{NULL, NULL}  
};  
 
diff --git a/src/makefile b/src/makefile  
index 8d3521e..09d4882 100644  
--- a/src/makefile  
+++ b/src/makefile  
@@ -262,6 +262,7 @@ SOCKET_OBJS= \  
auxiliar.$(O) \  
options.$(O) \  
inet.$(O) \  
+ if.$(O) \  
$(SOCKET) \  
except.$(O) \  
select.$(O) \  
@@ -387,6 +388,7 @@ auxiliar.$(O): auxiliar.c auxiliar.h  
buffer.$(O): buffer.c buffer.h io.h timeout.h  
except.$(O): except.c except.h  
inet.$(O): inet.c inet.h socket.h io.h timeout.h usocket.h  
+if.$(O): if.c if.h  
io.$(O): io.c io.h timeout.h  
luasocket.$(O): luasocket.c luasocket.h auxiliar.h except.h \  
timeout.h buffer.h io.h inet.h socket.h usocket.h tcp.h \  
diff --git a/src/options.c b/src/options.c  
index 8ac2a14..1c73e6f 100644  
--- a/src/options.c  
+++ b/src/options.c  
@@ -3,6 +3,9 @@  
* LuaSocket toolkit  
\*=========================================================================*/  
#include <string.h>  
+#include <sys/types.h>  
+#include <sys/socket.h>  
+#include <net/if.h>  
 
#include "lauxlib.h"  
 
@@ -285,6 +288,12 @@ static int opt_ip6_setmembership(lua_State *L, p_socket ps, int level, int name)  
if (!lua_isnil(L, -1)) {  
if (lua_isnumber(L, -1)) {  
val.ipv6mr_interface = (unsigned int) lua_tonumber(L, -1);  
+ } else if (lua_isstring(L, -1)) {  
+ if (!(val.ipv6mr_interface = if_nametoindex(lua_tostring(L, -1)))) {  
+ lua_pushnil(L);  
+ lua_pushstring(L, "nonexistent interface");  
+ return 2;  
+ }  
} else  
luaL_argerror(L, -1, "number 'interface' field expected");  
}  
--  
1.8.4.rc3  
 
 
file:a/libs/giflib/Makefile (deleted)
#  
# Copyright (C) 2006 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:=giflib  
PKG_VERSION:=4.1.6  
PKG_RELEASE:=1  
 
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2  
PKG_SOURCE_URL:=@SF/giflib  
PKG_MD5SUM:=7125644155ae6ad33dbc9fc15a14735f  
 
PKG_LICENSE:=MIT  
PKG_LICENSE_FILES:=COPYING  
 
PKG_FIXUP:=autoreconf  
PKG_REMOVE_FILES:=autogen.sh aclocal.m4  
 
include $(INCLUDE_DIR)/package.mk  
 
define Package/giflib  
SECTION:=libs  
CATEGORY:=Libraries  
TITLE:=GIF libraries  
URL:=http://sourceforge.net/projects/giflib  
endef  
 
define Package/giflib/description  
giflib is a library for reading and writing gif images.  
It is API and ABI compatible with libungif which was in wide use while  
the LZW compression algorithm was patented.  
endef  
 
TARGET_CFLAGS += $(FPIC)  
CONFIGURE_ARGS += --enable-x11=no  
 
define Build/Compile  
$(MAKE) -C $(PKG_BUILD_DIR)  
endef  
 
define Build/InstallDev  
$(INSTALL_DIR) $(1)/usr/{lib,include}  
$(CP) $(PKG_BUILD_DIR)/lib/.libs/lib*so* $(1)/usr/lib  
$(CP) $(PKG_BUILD_DIR)/lib/.libs/libgif.a $(1)/usr/lib  
$(CP) $(PKG_BUILD_DIR)/lib/libgif.la $(1)/usr/lib  
$(CP) $(PKG_BUILD_DIR)/lib/*.h $(1)/usr/include/  
endef  
 
define Package/giflib/install  
$(INSTALL_DIR) $(1)/usr/lib  
$(CP) $(PKG_BUILD_DIR)/lib/.libs/lib*so* $(1)/usr/lib/  
endef  
 
$(eval $(call BuildPackage,giflib))  
 
#  
# Copyright (C) 2005-2011 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:=libgpg-error  
PKG_VERSION:=1.9  
PKG_RELEASE:=1  
 
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2  
PKG_SOURCE_URL:=ftp://ftp.gnupg.org/gcrypt/libgpg-error  
PKG_MD5SUM:=521b98aa9395e7eaf0ef2236233a0796  
 
PKG_BUILD_PARALLEL:=1  
PKG_FIXUP:=autoreconf  
PKG_INSTALL:=1  
 
include $(INCLUDE_DIR)/package.mk  
 
define Package/libgpg-error  
SECTION:=libs  
CATEGORY:=Libraries  
TITLE:=GnuPG error handling helper library  
URL:=http://www.gnupg.org/related_software/libgpg-error/  
endef  
 
define Package/libgpg-error/description  
An helper library for common error codes and descriptions.  
This is a library that defines common error values for all GnuPG  
components. Among these are GPG, GPGSM, GPGME, GPG-Agent, libgcrypt,  
Libksba, DirMngr, Pinentry, SmartCard Daemon and possibly more in the  
future.  
endef  
 
TARGET_CFLAGS += $(FPIC)  
 
CONFIGURE_ARGS += \  
--enable-shared \  
--enable-static \  
--disable-rpath  
 
define Build/InstallDev  
$(INSTALL_DIR) $(2)/bin $(1)/usr/bin  
$(INSTALL_BIN) \  
$(PKG_INSTALL_DIR)/usr/bin/gpg-error-config \  
$(2)/bin/  
$(SED) \  
's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' \  
$(2)/bin/gpg-error-config  
ln -sf $(STAGING_DIR)/host/bin/gpg-error-config $(1)/usr/bin/gpg-error-config  
 
$(INSTALL_DIR) $(1)/usr/include  
$(INSTALL_DATA) \  
$(PKG_INSTALL_DIR)/usr/include/gpg-error.h \  
$(1)/usr/include/  
 
$(INSTALL_DIR) $(1)/usr/lib  
$(CP) \  
$(PKG_INSTALL_DIR)/usr/lib/libgpg-error.{la,a,so*} \  
$(1)/usr/lib/  
 
$(INSTALL_DIR) $(1)/usr/share/aclocal  
$(INSTALL_DATA) \  
$(PKG_INSTALL_DIR)/usr/share/aclocal/gpg-error.m4 \  
$(1)/usr/share/aclocal/  
endef  
 
define Package/libgpg-error/install  
$(INSTALL_DIR) $(1)/usr/lib  
$(CP) \  
$(PKG_INSTALL_DIR)/usr/lib/libgpg-error.so.* \  
$(1)/usr/lib/  
endef  
 
$(eval $(call BuildPackage,libgpg-error))  
 
file:a/libs/libmpeg2/Makefile (deleted)
#  
# Copyright (C) 2011 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:=libmpeg2  
PKG_VERSION:=0.5.1  
PKG_RELEASE:=1  
 
PKG_SOURCE:=libmpeg2-$(PKG_VERSION).tar.gz  
PKG_SOURCE_URL:=http://libmpeg2.sourceforge.net/files/  
PKG_MD5SUM:=0f92c7454e58379b4a5a378485bbd8ef  
 
PKG_INSTALL:=1  
 
include $(INCLUDE_DIR)/package.mk  
 
define Package/libmpeg2  
SECTION:=libs  
CATEGORY:=Libraries  
TITLE:=MPEG-1 & -2 decoding library  
URL:=http://libmpeg2.sourceforge.net/  
MAINTAINER:=W. Michael Petullo <mike@flyn.org>  
endef  
 
define Package/libmpeg2/decription  
Libmpeg2 is a library for decoding MPEG-1 and MPEG-2 video streams  
endef  
 
CONFIGURE_ARGS += \  
--disable-sdl \  
--without-x \  
 
define Build/InstallDev  
$(INSTALL_DIR) $(1)/usr/include  
$(CP) \  
$(PKG_INSTALL_DIR)/usr/include/mpeg2dec \  
$(1)/usr/include/  
$(INSTALL_DIR) $(1)/usr/lib  
$(CP) \  
$(PKG_INSTALL_DIR)/usr/lib/libmpeg2{,convert}.{a,so*} \  
$(1)/usr/lib/  
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig  
$(INSTALL_DATA) \  
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libmpeg2{,convert}.pc \  
$(1)/usr/lib/pkgconfig/  
endef  
 
define Package/libmpeg2/install  
$(INSTALL_DIR) $(1)/usr/lib  
$(CP) \  
$(PKG_INSTALL_DIR)/usr/lib/libmpeg2{,convert}.so.* \  
$(1)/usr/lib/  
endef  
 
$(eval $(call BuildPackage,libmpeg2))  
 
--- a/libmpeg2/motion_comp_altivec.c  
+++ b/libmpeg2/motion_comp_altivec.c  
@@ -25,6 +25,8 @@  
 
#ifdef ARCH_PPC  
 
+#ifdef __I_WANT_ALTIVEC__  
+  
#ifdef HAVE_ALTIVEC_H  
#include <altivec.h>  
#endif  
@@ -1007,4 +1009,6 @@ static void MC_avg_xy_8_altivec (uint8_t  
 
MPEG2_MC_EXTERN (altivec)  
 
+#endif /* __I_WANT_ALTIVEC__ */  
+  
#endif  
--- a/libmpeg2/idct_altivec.c  
+++ b/libmpeg2/idct_altivec.c  
@@ -25,6 +25,8 @@  
 
#ifdef ARCH_PPC  
 
+#ifdef __I_WANT_ALTIVEC__  
+  
#ifdef HAVE_ALTIVEC_H  
#include <altivec.h>  
#endif  
@@ -283,4 +285,6 @@ void mpeg2_idct_altivec_init (void)  
}  
}  
 
+#endif /* __I_WANT_ALTIVEC__ */  
+  
#endif  
--- a/libmpeg2/idct.c  
+++ b/libmpeg2/idct.c  
@@ -251,11 +251,13 @@ void mpeg2_idct_init (uint32_t accel)  
} else  
#endif  
#ifdef ARCH_PPC  
+#ifdef __I_WANT_ALTIVEC__  
if (accel & MPEG2_ACCEL_PPC_ALTIVEC) {  
mpeg2_idct_copy = mpeg2_idct_copy_altivec;  
mpeg2_idct_add = mpeg2_idct_add_altivec;  
mpeg2_idct_altivec_init ();  
} else  
+#endif /* __I_WANT_ALTIVEC__ */  
#endif  
#ifdef ARCH_ALPHA  
if (accel & MPEG2_ACCEL_ALPHA_MVI) {  
--- a/libmpeg2/motion_comp.c  
+++ b/libmpeg2/motion_comp.c  
@@ -43,9 +43,11 @@ void mpeg2_mc_init (uint32_t accel)  
else  
#endif  
#ifdef ARCH_PPC  
+#ifdef __I_WANT_ALTIVEC__  
if (accel & MPEG2_ACCEL_PPC_ALTIVEC)  
mpeg2_mc = mpeg2_mc_altivec;  
else  
+#endif /* __I_WANT_ALTIVEC__ */  
#endif  
#ifdef ARCH_ALPHA  
if (accel & MPEG2_ACCEL_ALPHA)  
 
diff -urN libmpeg2-0.5.1/libmpeg2/motion_comp_arm_s.S libmpeg2-0.5.1.new/libmpeg2/motion_comp_arm_s.S  
--- libmpeg2-0.5.1/libmpeg2/motion_comp_arm_s.S 2008-07-09 21:16:05.000000000 +0200  
+++ libmpeg2-0.5.1.new/libmpeg2/motion_comp_arm_s.S 2012-07-30 15:22:58.664964215 +0200  
@@ -19,6 +19,15 @@  
@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
 
 
+@ Data preload is supported only by ARM V5TE and above  
+  
+#if (defined (__ARM_ARCH_2__) || defined (__ARM_ARCH_3__) \  
+ || defined (__ARM_ARCH_3M__) || defined (__ARM_ARCH_4__) \  
+ || defined (__ARM_ARCH_4T__) || defined (__ARM_ARCH_5__) \  
+ || defined (__ARM_ARCH_5T__))  
+.macro pld reg  
+.endm  
+#endif  
.text  
 
@ ----------------------------------------------------------------  
 
file:a/libs/liboil/Makefile (deleted)
#  
# Copyright (C) 2007-2010 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:=liboil  
PKG_VERSION:=0.3.17  
PKG_RELEASE:=1  
 
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz  
PKG_SOURCE_URL:=http://liboil.freedesktop.org/download/  
PKG_MD5SUM:=47dc734f82faeb2964d97771cfd2e701  
 
PKG_FIXUP:=autoreconf  
PKG_INSTALL:=1  
 
include $(INCLUDE_DIR)/package.mk  
 
define Package/liboil  
SECTION:=libs  
CATEGORY:=Libraries  
TITLE:=simple functions optimized for various CPUs  
URL:=http://liboil.freedesktop.org/wiki/  
DEPENDS:=+librt  
endef  
 
define Package/liboil/description  
Liboil is a library of simple functions that are optimized for various CPUs.  
These functions are generally loops implementing simple algorithms, such as  
converting an array of N integers to floating-point numbers or multiplying  
and summing an array of N numbers. Such functions are candidates for significant  
optimization using various techniques, especially by using extended instructions  
provided by modern CPUs (Altivec, MMX, SSE, etc.).  
endef  
 
CONFIGURE_ARGS += \  
--enable-shared \  
--enable-static \  
 
TARGET_CFLAGS += $(FPIC)  
 
# XXX: VFP_CFLAGS is set to '-mfpu=vfp' on arm by configure, but that breaks  
# final linking stages, so override it until we find why  
MAKE_FLAGS += \  
VFP_CFLAGS="" \  
 
define Build/InstallDev  
$(INSTALL_DIR) $(1)/usr/include  
$(CP) $(PKG_INSTALL_DIR)/usr/include/liboil-0.3/* $(1)/usr/include/  
$(INSTALL_DIR) $(1)/usr/lib  
$(CP) $(PKG_INSTALL_DIR)/usr/lib/liboil-0.3.{a,so*} $(1)/usr/lib/  
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig  
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/liboil-0.3.pc $(1)/usr/lib/pkgconfig/  
endef  
 
define Package/liboil/install  
$(INSTALL_DIR) $(1)/usr/lib  
$(CP) $(PKG_INSTALL_DIR)/usr/lib/liboil-0.3.so.* $(1)/usr/lib/  
endef  
 
$(eval $(call BuildPackage,liboil))  
 
--- a/Makefile.am  
+++ b/Makefile.am  
@@ -1,7 +1,7 @@  
 
AUTOMAKE_OPTIONS = foreign  
 
-SUBDIRS = liboil testsuite examples doc  
+SUBDIRS = liboil  
 
EXTRA_DIST = COPYING autogen.sh gtk-doc.make HACKING BUG-REPORTING  
 
--- a/Makefile.in  
+++ b/Makefile.in  
@@ -278,7 +278,7 @@ top_build_prefix = @top_build_prefix@  
top_builddir = @top_builddir@  
top_srcdir = @top_srcdir@  
AUTOMAKE_OPTIONS = foreign  
-SUBDIRS = liboil testsuite examples doc  
+SUBDIRS = liboil  
EXTRA_DIST = COPYING autogen.sh gtk-doc.make HACKING BUG-REPORTING  
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc  
pkgconfig_DATA = liboil-$(LIBOIL_MAJORMINOR).pc  
 
--- a/liboil.pc.in  
+++ b/liboil.pc.in  
@@ -1,7 +1,7 @@  
prefix=@prefix@  
exec_prefix=@exec_prefix@  
libdir=@libdir@  
-includedir=@includedir@/liboil-@LIBOIL_MAJORMINOR@  
+includedir=@includedir@  
toolsdir=${exec_prefix}/bin  
 
 
@@ -9,6 +9,6 @@ Name: liboil-@LIBOIL_MAJORMINOR@  
Description: Library of Optimized Inner Loops  
Version: @VERSION@  
Libs: -L${libdir} -loil-@LIBOIL_MAJORMINOR@ @LIBM@ @LIBRT@  
-Cflags: -I${includedir}  
+Cflags: -I${includedir}/liboil-@LIBOIL_MAJORMINOR@  
 
 
 
file:a/libs/libtheora/Makefile (deleted)
#  
# Copyright (C) 2008-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:=libtheora  
PKG_VERSION:=1.1.1  
PKG_RELEASE:=1  
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2  
PKG_SOURCE_URL:=http://downloads.xiph.org/releases/theora/  
PKG_MD5SUM:=292ab65cedd5021d6b7ddd117e07cd8e  
PKG_FIXUP:=autoreconf  
 
PKG_BUILD_DEPENDS:=libvorbis  
 
include $(INCLUDE_DIR)/package.mk  
 
PKG_INSTALL=1  
 
define Package/libtheora  
SECTION:=libs  
CATEGORY:=Libraries  
TITLE:=libtheora  
URL:=http://xiph.org/theora/  
DEPENDS:=+libogg  
endef  
 
define Package/libtheora/description  
Theora is Xiph.Org's first publicly released video codec, intended  
for use within the Foundation's Ogg multimedia streaming system.  
Theora is derived directly from On2's VP3 codec; Currently the  
encoders are nearly identical, but Theora will make use of new  
features supported by the decoder to improve over what is  
is possible with VP3.  
endef  
 
define Build/Configure  
$(call Build/Configure/Default, \  
--disable-examples \  
--disable-oggtest \  
--disable-vorbistest \  
--disable-sdltest \  
)  
endef  
 
define Build/InstallDev  
$(INSTALL_DIR) $(1)/usr/include/theora/  
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/theora/* $(1)/usr/include/theora/  
$(INSTALL_DIR) $(1)/usr/lib/  
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.{so*,a,la} $(1)/usr/lib/  
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig/  
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* $(1)/usr/lib/pkgconfig/  
endef  
 
define Package/libtheora/install  
$(INSTALL_DIR) $(1)/usr/lib/  
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/  
endef  
 
$(eval $(call BuildPackage,libtheora))  
 
diff -urN libtheora-1.1.1/Makefile.am libtheora-1.1.1.new/Makefile.am  
--- libtheora-1.1.1/Makefile.am 2009-07-14 01:55:02.000000000 +0200  
+++ libtheora-1.1.1.new/Makefile.am 2012-12-05 14:21:06.103521554 +0100  
@@ -8,7 +8,7 @@  
EXAMPLES_DIR =  
endif  
 
-SUBDIRS = lib include doc tests m4 $(EXAMPLES_DIR)  
+SUBDIRS = lib include m4 $(EXAMPLES_DIR)  
 
 
# we include the whole debian/ dir in EXTRA_DIST because there's a problem  
diff -urN libtheora-1.1.1/Makefile.in libtheora-1.1.1.new/Makefile.in  
--- libtheora-1.1.1/Makefile.in 2009-10-01 20:04:07.000000000 +0200  
+++ libtheora-1.1.1.new/Makefile.in 2012-12-05 14:21:18.239521864 +0100  
@@ -164,7 +164,7 @@  
@THEORA_ENABLE_EXAMPLES_TRUE@EXAMPLES_DIR = examples  
@THEORA_ENABLE_EXAMPLES_FALSE@EXAMPLES_DIR =  
 
-SUBDIRS = lib include doc tests m4 $(EXAMPLES_DIR)  
+SUBDIRS = lib include m4 $(EXAMPLES_DIR)  
 
# we include the whole debian/ dir in EXTRA_DIST because there's a problem  
# with autotools and HFS+ MacOSX file systems that caused debian/Makefile.am  
@@ -200,7 +200,7 @@  
missing mkinstalldirs theora-uninstalled.pc.in theora.pc.in \  
theoradec-uninstalled.pc.in theoradec.pc.in \  
theoraenc-uninstalled.pc.in theoraenc.pc.in  
-DIST_SUBDIRS = lib include doc tests m4 examples  
+DIST_SUBDIRS = lib include m4 examples  
all: config.h  
$(MAKE) $(AM_MAKEFLAGS) all-recursive  
 
 
--- libtheora-1.1.1/configure.ac 2009-10-01 20:00:33.000000000 +0200  
+++ libtheora-1.1.1.new/configure.ac 2012-12-05 14:22:26.319523608 +0100  
@@ -313,11 +313,6 @@  
dnl check for SDL  
HAVE_SDL=no  
 
-AM_PATH_SDL(,[  
- HAVE_SDL=yes  
- SDL_LIBS=`$SDL_CONFIG --libs`  
-],AC_MSG_WARN([*** Unable to find SDL -- Not compiling example players ***]))  
-  
dnl check for OSS  
HAVE_OSS=no  
AC_CHECK_HEADERS([sys/soundcard.h soundcard.h machine/soundcard.h],[  
 
file:a/libs/libxslt/Makefile (deleted)
#  
# Copyright (C) 2006-2011 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:=libxslt  
PKG_VERSION:=1.1.28  
PKG_RELEASE:=1  
 
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz  
PKG_SOURCE_URL:=http://xmlsoft.org/sources/ \  
ftp://fr.rpmfind.net/pub/libxml/  
PKG_MD5SUM:=9667bf6f9310b957254fdcf6596600b7  
 
PKG_FIXUP:=autoreconf  
PKG_INSTALL:=1  
 
include $(INCLUDE_DIR)/package.mk  
 
define Package/libxslt  
SECTION:=libs  
CATEGORY:=Libraries  
DEPENDS:=+libxml2  
TITLE:=Gnome XSLT library  
URL:=http://xmlsoft.org/XSLT/  
endef  
 
define Package/libxslt/description  
A library for XML transformation using XSLT.  
endef  
 
define Package/libexslt  
SECTION:=libs  
CATEGORY:=Libraries  
DEPENDS:=+libxslt  
TITLE:=Gnome XSLT library Extention  
URL:=http://xmlsoft.org/XSLT/EXSLT/  
endef  
 
define Package/libexslt/description  
A extention for XSLT.  
endef  
 
define Package/xsltproc  
SECTION:=utils  
CATEGORY:=Utilities  
DEPENDS:=+libxml2 +libxslt +libexslt  
TITLE:=Gnome XSLT xsltproc Utility  
URL:=http://xmlsoft.org/XSLT/  
endef  
 
define Package/xsltproc/description  
XSLT XML transformation utility  
endef  
 
CONFIGURE_ARGS+= \  
--enable-shared \  
--enable-static \  
--without-python \  
--without-crypto \  
--without-debug \  
--without-mem-debug \  
--without-debugger \  
 
TARGET_CFLAGS += $(FPIC)  
 
define Build/InstallDev/Xslt  
$(INSTALL_DIR) $(1)/usr/bin $(2)/bin $(1)/usr/include/libxslt \  
$(1)/usr/include/libexslt $(1)/usr/lib \  
$(1)/usr/lib/pkgconfig $(2)/share/aclocal  
 
$(INSTALL_BIN) \  
$(PKG_INSTALL_DIR)/usr/bin/xslt-config \  
$(2)/bin/  
 
ln -sf $(STAGING_DIR)/host/bin/xslt-config $(1)/usr/bin/xslt-config  
 
$(SED) \  
's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' \  
$(2)/bin/xslt-config  
 
$(INSTALL_DATA) \  
$(PKG_INSTALL_DIR)/usr/include/libxslt/* \  
$(1)/usr/include/libxslt/  
 
$(CP) \  
$(PKG_INSTALL_DIR)/usr/lib/libxslt.{la,a,so*} \  
$(1)/usr/lib/  
 
$(INSTALL_DATA) \  
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libxslt.pc \  
$(1)/usr/lib/pkgconfig/  
 
$(INSTALL_DATA) \  
$(PKG_INSTALL_DIR)/usr/share/aclocal/* \  
$(2)/share/aclocal  
endef  
 
define Build/InstallDev/Exslt  
$(INSTALL_DIR) $(1)/usr/include/libexslt $(1)/usr/lib/pkgconfig  
$(INSTALL_DATA) \  
$(PKG_INSTALL_DIR)/usr/include/libexslt/* \  
$(1)/usr/include/libexslt/  
 
$(CP) \  
$(PKG_INSTALL_DIR)/usr/lib/libexslt.{la,a,so*} \  
$(1)/usr/lib/  
 
$(INSTALL_DATA) \  
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libexslt.pc \  
$(1)/usr/lib/pkgconfig/  
endef  
 
define Build/InstallDev  
$(if $(CONFIG_PACKAGE_libxslt),$(call Build/InstallDev/Xslt,$(1),$(2)))  
$(if $(CONFIG_PACKAGE_libexslt),$(call Build/InstallDev/Exslt,$(1),$(2)))  
endef  
 
define Package/libxslt/install  
$(INSTALL_DIR) $(1)/usr/lib  
$(CP) \  
$(PKG_INSTALL_DIR)/usr/lib/libxslt.so.* \  
$(1)/usr/lib/  
endef  
 
define Package/libexslt/install  
$(INSTALL_DIR) $(1)/usr/lib  
$(CP) \  
$(PKG_INSTALL_DIR)/usr/lib/libexslt.so.* \  
$(1)/usr/lib/  
endef  
 
define Package/xsltproc/install  
$(INSTALL_DIR) $(1)/usr/bin  
$(INSTALL_BIN) \  
$(PKG_INSTALL_DIR)/usr/bin/xsltproc \  
$(1)/usr/bin/  
endef  
 
$(eval $(call BuildPackage,libxslt))  
$(eval $(call BuildPackage,libexslt))  
$(eval $(call BuildPackage,xsltproc))  
 
file:a/libs/tiff/Makefile (deleted)
#  
# Copyright (C) 2006-2012 OpenWrt.org  
#  
# This is free software, licensed under the GNU General Public License v2.  
# See /LICENSE for more information.  
#  
# blogic@openwrt.org  
 
include $(TOPDIR)/rules.mk  
 
PKG_NAME:=tiff  
PKG_VERSION:=4.0.3  
PKG_RELEASE:=1  
 
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz  
PKG_SOURCE_URL:=http://download.osgeo.org/libtiff  
PKG_MD5SUM:=051c1068e6a0627f461948c365290410  
 
PKG_FIXUP:=autoreconf  
PKG_REMOVE_FILES:=autogen.sh aclocal.m4  
 
PKG_INSTALL:=1  
 
PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_libtiffxx  
 
include $(INCLUDE_DIR)/uclibc++.mk  
include $(INCLUDE_DIR)/package.mk  
 
define Package/tiff/Default  
TITLE:=TIFF  
URL:=http://www.remotesensing.org/libtiff/  
endef  
 
define Package/libtiff  
$(call Package/tiff/Default)  
SECTION:=libs  
CATEGORY:=Libraries  
TITLE+= library  
DEPENDS:=+zlib +libjpeg  
endef  
 
define Package/libtiffxx  
$(call Package/tiff/Default)  
SECTION:=libs  
CATEGORY:=Libraries  
TITLE+= library(c++ bindings)  
DEPENDS:=+libtiff $(CXX_DEPENDS)  
endef  
 
define Package/tiff-utils  
$(call Package/tiff/Default)  
SECTION:=utils  
CATEGORY:=Utilities  
TITLE+= utilities  
DEPENDS:=+libtiff  
endef  
 
TARGET_CFLAGS += $(FPIC)  
 
define Build/Configure  
$(call Build/Configure/Default, \  
$(if $(CONFIG_PACKAGE_libtiffxx), \  
--enable-cxx, \  
--disable-cxx \  
) \  
--disable-lzma \  
--enable-ccitt \  
--enable-packbits \  
--enable-lzw \  
--enable-thunder \  
--enable-next \  
--enable-logluv \  
--enable-mdi \  
--enable-zlib \  
--enable-jpeg \  
--disable-old-jpeg \  
--disable-jbig \  
--without-x \  
)  
endef  
 
define Build/InstallDev  
$(INSTALL_DIR) $(1)/usr/{lib,include}  
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib* $(1)/usr/lib/  
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/  
endef  
 
define Package/libtiff/install  
$(INSTALL_DIR) $(1)/usr/lib  
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libtiff.so.* $(1)/usr/lib/  
endef  
 
define Package/libtiffxx/install  
$(INSTALL_DIR) $(1)/usr/lib  
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libtiffxx.so.* $(1)/usr/lib/  
endef  
 
define Package/tiff-utils/install  
$(INSTALL_DIR) $(1)/usr/bin  
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/  
endef  
 
$(eval $(call BuildPackage,libtiff))  
$(eval $(call BuildPackage,libtiffxx))  
$(eval $(call BuildPackage,tiff-utils))  
 
--- a/Makefile.am  
+++ b/Makefile.am  
@@ -25,7 +25,7 @@  
 
docdir = $(LIBTIFF_DOCDIR)  
 
-AUTOMAKE_OPTIONS = 1.12 dist-zip foreign  
+AUTOMAKE_OPTIONS = dist-zip foreign  
ACLOCAL_AMFLAGS = -I m4  
 
docfiles = \  
@@ -48,7 +48,7 @@ EXTRA_DIST = \  
 
dist_doc_DATA = $(docfiles)  
 
-SUBDIRS = port libtiff tools build contrib test man html  
+SUBDIRS = port libtiff tools build contrib  
 
release:  
(rm -f $(top_srcdir)/RELEASE-DATE && echo $(LIBTIFF_RELEASE_DATE) > $(top_srcdir)/RELEASE-DATE)  
--- a/test/Makefile.am  
+++ b/test/Makefile.am  
@@ -23,7 +23,7 @@  
 
# Process this file with automake to produce Makefile.in.  
 
-AUTOMAKE_OPTIONS = 1.12 color-tests parallel-tests foreign  
+AUTOMAKE_OPTIONS = color-tests parallel-tests foreign  
 
LIBTIFF = $(top_builddir)/libtiff/libtiff.la  
 
 
#  
# Copyright (C) 2010-2013 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:=minidlna  
PKG_VERSION:=1.0.25  
PKG_RELEASE:=1  
 
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION)_src.tar.gz  
PKG_SOURCE_URL:=@SF/minidlna  
PKG_MD5SUM:=d966256baf2f9b068b9de871ab5dade5  
 
PKG_BUILD_PARALLEL:=0  
PKG_BUILD_DEPENDS:=util-linux  
 
include $(INCLUDE_DIR)/kernel.mk  
include $(INCLUDE_DIR)/package.mk  
include $(INCLUDE_DIR)/nls.mk  
 
define Package/minidlna  
SECTION:=multimedia  
CATEGORY:=Multimedia  
TITLE:=UPnP A/V & DLNA Media Server  
URL:=http://minidlna.sourceforge.net/  
DEPENDS:= +libpthread +libexif +libjpeg +libsqlite3 +libffmpeg \  
+libid3tag +libflac +libvorbis +libuuid \  
$(ICONV_DEPENDS) $(INTL_DEPENDS)  
endef  
 
define Package/minidlna/description  
MiniDLNA (aka ReadyDLNA) is server software with the aim of  
being fully compliant with DLNA/UPnP-AV clients.  
endef  
 
define Package/minidlna/conffiles  
/etc/minidlna.conf  
endef  
 
TARGET_CPPFLAGS += \  
-I$(STAGING_DIR)/usr/include \  
-I$(STAGING_DIR)/usr/include/FLAC \  
-I$(STAGING_DIR)/usr/include/libavcodec \  
-I$(STAGING_DIR)/usr/include/libavformat \  
-I$(STAGING_DIR)/usr/include/libavutil \  
-I$(STAGING_DIR)/usr/include/libexif \  
-I$(STAGING_DIR)/usr/include/uuid \  
-I$(STAGING_DIR)/usr/include/vorbis \  
-I$(ICONV_PREFIX)/include \  
-I$(INTL_PREFIX)/include \  
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \  
 
TARGET_LDFLAGS += \  
-L$(ICONV_PREFIX)/lib \  
-L$(INTL_PREFIX)/lib \  
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \  
 
MAKE_FLAGS +=\  
CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \  
LDFLAGS="$(TARGET_LDFLAGS)" \  
ICONV_LIBS="-liconv $(if $(INTL_FULL),-lintl)" \  
 
MAKE_VARS +=\  
PREFIX="$(STAGING_DIR)/usr" \  
ICONV_PREFIX="$(ICONV_PREFIX)" \  
INTL_PREFIX="$(INTL_PREFIX)" \  
OS_NAME="OpenWrt Linux" \  
OS_VERSION="$(LINUX_VERSION)" \  
OS_URL="http://openwrt.org/" \  
DB_PATH="/var/run/minidlna" \  
LOG_PATH="/var/log" \  
 
 
define Package/minidlna/install  
$(INSTALL_DIR) $(1)/usr/bin  
$(INSTALL_BIN) $(PKG_BUILD_DIR)/minidlna $(1)/usr/bin/  
$(INSTALL_DIR) $(1)/etc/init.d  
$(INSTALL_BIN) ./files/minidlna.init $(1)/etc/init.d/minidlna  
$(INSTALL_DIR) $(1)/etc/config  
$(INSTALL_CONF) ./files/minidlna.config $(1)/etc/config/minidlna  
endef  
 
define Package/minidlna/conffiles  
/etc/config/minidlna  
endef  
 
$(eval $(call BuildPackage,minidlna))  
 
config minidlna config  
option 'enabled' '0'  
option port '8200'  
option interface 'br-lan'  
option friendly_name 'OpenWrt DLNA Server'  
option db_dir '/var/run/minidlna'  
option log_dir '/var/log'  
option inotify '1'  
option enable_tivo '0'  
option strict_dlna '0'  
option presentation_url ''  
option notify_interval '900'  
option serial '12345678'  
option model_number '1'  
option root_container '.'  
list media_dir '/mnt'  
option album_art_names 'Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg'  
 
#!/bin/sh /etc/rc.common  
# Copyright (C) 2010 OpenWrt.org  
 
START=50  
 
SERVICE_USE_PID=1  
 
MINIDLNA_CONFIG_FILE="/tmp/minidlna.conf"  
 
minidlna_cfg_append() {  
echo "$1" >> "$MINIDLNA_CONFIG_FILE"  
}  
 
minidlna_cfg_addbool() {  
local cfg="$1"  
local key="$2"  
local def="$3"  
local val  
 
config_get_bool val "$cfg" "$key" "$def"  
[ "$val" -gt 0 ] && val="yes" || val="no"  
minidlna_cfg_append "$key=$val"  
}  
 
minidlna_cfg_addstr() {  
local cfg="$1"  
local key="$2"  
local def="$3"  
local val  
 
config_get val "$cfg" "$key" "$def"  
[ -n "$val" ] && minidlna_cfg_append "$key=$val"  
}  
 
minidlna_cfg_add_media_dir() {  
local val=$1  
 
minidlna_cfg_append "media_dir=$val"  
}  
 
minidlna_create_config() {  
local cfg=$1  
local port  
local interface  
 
config_get port $cfg port  
config_get interface $cfg interface  
 
[ -z "$interface" -o -t "$port" ] && return 1  
 
echo "# this file is generated automatically, don't edit" > "$MINIDLNA_CONFIG_FILE"  
 
minidlna_cfg_append "port=$port"  
minidlna_cfg_append "network_interface=$interface"  
 
minidlna_cfg_addstr $cfg friendly_name  
minidlna_cfg_addstr $cfg db_dir  
minidlna_cfg_addstr $cfg log_dir  
minidlna_cfg_addbool $cfg inotify '1'  
minidlna_cfg_addbool $cfg enable_tivo '0'  
minidlna_cfg_addbool $cfg strict_dlna '0'  
minidlna_cfg_addstr $cfg album_art_names  
minidlna_cfg_addstr $cfg presentation_url  
minidlna_cfg_addstr $cfg notify_interval '900'  
minidlna_cfg_addstr $cfg serial '12345678'  
minidlna_cfg_addstr $cfg model_number '1'  
minidlna_cfg_addstr $cfg minissdpsocket  
minidlna_cfg_addstr $cfg root_container '.'  
config_list_foreach "$cfg" "media_dir" minidlna_cfg_add_media_dir  
 
return 0  
}  
 
start() {  
local enabled  
local db_dir  
local log_dir  
 
config_load 'minidlna'  
config_get_bool enabled config 'enabled' '0'  
 
[ "$enabled" -gt 0 ] || return 1  
 
minidlna_create_config config || return 1  
 
config_get db_dir config 'db_dir' '/var/run/minidlna'  
config_get log_dir config 'log_dir' '/var/log'  
 
mkdir -m 0755 -p $db_dir  
mkdir -m 0755 -p $log_dir  
service_start /usr/bin/minidlna -f "$MINIDLNA_CONFIG_FILE"  
}  
 
stop() {  
service_stop /usr/bin/minidlna  
}  
 
--- a/genconfig.sh  
+++ b/genconfig.sh  
@@ -23,14 +23,18 @@ RM="rm -f"  
CONFIGFILE="config.h"  
CONFIGMACRO="__CONFIG_H__"  
 
+PREFIX="${PREFIX:-/usr}"  
+ICONV_PREFIX="${ICONV_PREFIX:-$PREFIX}"  
+INTL_PREFIX="${INTL_PREFIX:-$PREFIX}"  
+  
# Database path  
-DB_PATH="/tmp/minidlna"  
+DB_PATH="${DB_PATH:-/tmp/minidlna}"  
# Log path  
-LOG_PATH="${DB_PATH}"  
+LOG_PATH="${LOG_PATH:-$DB_PATH}"  
 
# detecting the OS name and version  
-OS_NAME=`uname -s`  
-OS_VERSION=`uname -r`  
+OS_NAME="${OS_NAME:-$(uname -s)}"  
+OS_VERSION="${OS_VERSION:-$(uname -r)}"  
TIVO="/*#define TIVO_SUPPORT*/"  
NETGEAR="/*#define NETGEAR*/"  
READYNAS="/*#define READYNAS*/"  
@@ -40,22 +44,22 @@ ${RM} ${CONFIGFILE}  
 
# Detect if there are missing headers  
# NOTE: This check only works with a normal distro  
-[ ! -e "/usr/include/sqlite3.h" ] && MISSING="libsqlite3 $MISSING"  
-[ ! -e "/usr/include/jpeglib.h" ] && MISSING="libjpeg $MISSING"  
-[ ! -e "/usr/include/libexif/exif-loader.h" ] && MISSING="libexif $MISSING"  
-[ ! -e "/usr/include/id3tag.h" ] && MISSING="libid3tag $MISSING"  
-[ ! -e "/usr/include/ogg/ogg.h" ] && MISSING="libogg $MISSING"  
-[ ! -e "/usr/include/vorbis/codec.h" ] && MISSING="libvorbis $MISSING"  
-[ ! -e "/usr/include/FLAC/metadata.h" ] && MISSING="libflac $MISSING"  
-[ ! -e "/usr/include/ffmpeg/avutil.h" -a \  
- ! -e "/usr/include/libavutil/avutil.h" -a \  
- ! -e "/usr/include/ffmpeg/libavutil/avutil.h" ] && MISSING="libavutil $MISSING"  
-[ ! -e "/usr/include/ffmpeg/avformat.h" -a \  
- ! -e "/usr/include/libavformat/avformat.h" -a \  
- ! -e "/usr/include/ffmpeg/libavformat/avformat.h" ] && MISSING="libavformat $MISSING"  
-[ ! -e "/usr/include/ffmpeg/avcodec.h" -a \  
- ! -e "/usr/include/libavcodec/avcodec.h" -a \  
- ! -e "/usr/include/ffmpeg/libavcodec/avcodec.h" ] && MISSING="libavcodec $MISSING"  
+[ ! -e "${PREFIX}/include/sqlite3.h" ] && MISSING="libsqlite3 $MISSING"  
+[ ! -e "${PREFIX}/include/jpeglib.h" ] && MISSING="libjpeg $MISSING"  
+[ ! -e "${PREFIX}/include/libexif/exif-loader.h" ] && MISSING="libexif $MISSING"  
+[ ! -e "${PREFIX}/include/id3tag.h" ] && MISSING="libid3tag $MISSING"  
+[ ! -e "${PREFIX}/include/ogg/ogg.h" ] && MISSING="libogg $MISSING"  
+[ ! -e "${PREFIX}/include/vorbis/codec.h" ] && MISSING="libvorbis $MISSING"  
+[ ! -e "${PREFIX}/include/FLAC/metadata.h" ] && MISSING="libflac $MISSING"  
+[ ! -e "${PREFIX}/include/ffmpeg/avutil.h" -a \  
+ ! -e "${PREFIX}/include/libavutil/avutil.h" -a \  
+ ! -e "${PREFIX}/include/ffmpeg/libavutil/avutil.h" ] && MISSING="libavutil $MISSING"  
+[ ! -e "${PREFIX}/include/ffmpeg/avformat.h" -a \  
+ ! -e "${PREFIX}/include/libavformat/avformat.h" -a \  
+ ! -e "${PREFIX}/include/ffmpeg/libavformat/avformat.h" ] && MISSING="libavformat $MISSING"  
+[ ! -e "${PREFIX}/include/ffmpeg/avcodec.h" -a \  
+ ! -e "${PREFIX}/include/libavcodec/avcodec.h" -a \  
+ ! -e "${PREFIX}/include/ffmpeg/libavcodec/avcodec.h" ] && MISSING="libavcodec $MISSING"  
if [ -n "$MISSING" ]; then  
echo -e "\nERROR! Cannot continue."  
echo -e "The following required libraries are either missing, or are missing development headers:\n"  
@@ -151,8 +155,7 @@ case $OS_NAME in  
fi  
;;  
*)  
- echo "Unknown OS : $OS_NAME"  
- exit 1  
+ echo "WARNING: Unknown OS : $OS_NAME" 1>&2  
;;  
esac  
 
@@ -183,7 +186,7 @@ fi  
echo "" >> ${CONFIGFILE}  
 
echo "/* Enable if the system iconv.h exists. ID3 tag reading in various character sets will not work properly otherwise. */" >> ${CONFIGFILE}  
-if [ -f /usr/include/iconv.h ]; then  
+if [ -f ${ICONV_PREFIX}/include/iconv.h ]; then  
echo "#define HAVE_ICONV_H" >> ${CONFIGFILE}  
else  
echo -e "\nWARNING!! Iconv support not found. ID3 tag reading may not work."  
@@ -192,7 +195,7 @@ fi  
echo "" >> ${CONFIGFILE}  
 
echo "/* Enable if the system libintl.h exists for NLS support. */" >> ${CONFIGFILE}  
-if [ -f /usr/include/libintl.h ]; then  
+if [ -f ${INTL_PREFIX}/include/libintl.h ]; then  
echo "#define ENABLE_NLS" >> ${CONFIGFILE}  
else  
echo "/*#define ENABLE_NLS*/" >> ${CONFIGFILE}  
 
--- a/Makefile  
+++ b/Makefile  
@@ -10,19 +10,23 @@  
# or :  
# $ make install  
#  
+PREFIX ?= /usr  
+ICONV_PREFIX ?= $(PREFIX)  
+INTL_PREFIX ?= $(PREFIX)  
#CFLAGS = -Wall -O -D_GNU_SOURCE -g -DDEBUG  
#CFLAGS = -Wall -g -Os -D_GNU_SOURCE  
CFLAGS = -Wall -g -O3 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \  
- -I/usr/include/ffmpeg \  
- -I/usr/include/libavutil -I/usr/include/libavcodec -I/usr/include/libavformat \  
- -I/usr/include/ffmpeg/libavutil -I/usr/include/ffmpeg/libavcodec -I/usr/include/ffmpeg/libavformat  
+ -I$(PREFIX)/include/ffmpeg \  
+ -I$(PREFIX)/include/libavutil -I$(PREFIX)/include/libavcodec -I$(PREFIX)/include/libavformat \  
+ -I$(PREFIX)/include/ffmpeg/libavutil -I$(PREFIX)/include/ffmpeg/libavcodec -I$(PREFIX)/include/ffmpeg/libavformat  
+  
#STATIC_LINKING: CFLAGS += -DSTATIC  
#STATIC_LINKING: LDFLAGS = -static  
CC = gcc  
RM = rm -f  
INSTALL = install  
 
-INSTALLPREFIX ?= $(DESTDIR)/usr  
+INSTALLPREFIX ?= $(DESTDIR)$(PREFIX)  
SBININSTALLDIR = $(INSTALLPREFIX)/sbin  
ETCINSTALLDIR = $(DESTDIR)/etc  
 
@@ -37,7 +41,7 @@ BASEOBJS = minidlna.o upnphttp.o upnpdes  
 
ALLOBJS = $(BASEOBJS) $(LNXOBJS)  
 
-LIBS = -lpthread -lexif -ljpeg -lsqlite3 -lavformat -lavutil -lavcodec -lid3tag -lFLAC -logg -lvorbis  
+LIBS = -lpthread -lexif -ljpeg -lsqlite3 -lavformat -lavutil -lavcodec -lid3tag -lFLAC -logg -lvorbis -luuid $(ICONV_LIBS)  
#STATIC_LINKING: LIBS = -lvorbis -logg -lm -lsqlite3 -lpthread -lexif -ljpeg -lFLAC -lm -lid3tag -lz -lavformat -lavutil -lavcodec -lm  
 
TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o  
@@ -64,7 +68,7 @@ install-conf:  
$(INSTALL) -d $(ETCINSTALLDIR)  
$(INSTALL) --mode=0644 minidlna.conf $(ETCINSTALLDIR)  
 
-minidlna: $(BASEOBJS) $(LNXOBJS) $(LIBS)  
+minidlna: $(BASEOBJS) $(LNXOBJS)  
@echo Linking $@  
@$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(BASEOBJS) $(LNXOBJS) $(LIBS)  
 
 
--- a/minidlna.c  
+++ b/minidlna.c  
@@ -58,6 +58,7 @@  
#include <fcntl.h>  
#include <sys/file.h>  
#include <sys/time.h>  
+#include <sys/stat.h>  
#include <time.h>  
#include <signal.h>  
#include <sys/param.h>  
 
--- a/metadata.c 2012-08-27 23:00:06.997932249 +0100  
+++ b/metadata.c 2012-08-27 23:10:07.716582960 +0100  
@@ -110,7 +110,7 @@ lav_open(AVFormatContext **ctx, const ch  
static inline void  
lav_close(AVFormatContext *ctx)  
{  
-#if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(2<<8)+0)  
+#if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(17<<8)+0)  
avformat_close_input(&ctx);  
#else  
av_close_input_file(ctx);  
 
file:a/net/lighttpd/Makefile (deleted)
#  
# Copyright (C) 2006-2013 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:=lighttpd  
PKG_VERSION:=1.4.35  
PKG_RELEASE:=1  
 
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz  
PKG_SOURCE_URL:=http://download.lighttpd.net/lighttpd/releases-1.4.x  
PKG_MD5SUM:=c7ae774eab4cb7ac85e41b712f4ee9ba  
 
PKG_LICENSE:=BSD-3c  
PKG_LICENSE_FILES:=COPYING  
 
PKG_FIXUP:=autoreconf  
PKG_INSTALL:=1  
 
include $(INCLUDE_DIR)/package.mk  
 
define Package/lighttpd/Default  
SUBMENU:=Web Servers/Proxies  
SECTION:=net  
CATEGORY:=Network  
URL:=http://www.lighttpd.net/  
endef  
 
define Package/lighttpd  
$(call Package/lighttpd/Default)  
MENU:=1  
DEPENDS:=+LIGHTTPD_SSL:libopenssl +libpcre +libpthread  
TITLE:=A flexible and lightweight web server  
endef  
 
define Package/lighttpd/config  
config LIGHTTPD_SSL  
bool "SSL support"  
depends on PACKAGE_lighttpd  
default y  
help  
Implements SSL support in lighttpd (using libopenssl). This  
option is required if you enable the SSL engine in your  
lighttpd confguration file.  
endef  
 
CONFIGURE_ARGS+= \  
--libdir=/usr/lib/lighttpd \  
--sysconfdir=/etc/lighttpd \  
--enable-shared \  
--enable-static \  
--disable-rpath \  
--without-attr \  
--without-bzip2 \  
--without-fam \  
--without-gdbm \  
--without-ldap \  
--without-lua \  
--without-memcache \  
--with-pcre \  
--without-valgrind \  
$(call autoconf_bool,CONFIG_IPV6,ipv6)  
 
CONFIGURE_VARS+= \  
PCRE_LIB="-lpcre" \  
 
ifneq ($(strip $(CONFIG_LIGHTTPD_SSL)),)  
CONFIGURE_ARGS+= \  
--with-openssl="$(STAGING_DIR)/usr"  
else  
CONFIGURE_ARGS+= \  
--without-openssl  
endif  
 
ifneq ($(SDK)$(CONFIG_PACKAGE_lighttpd-mod-mysql-vhost),)  
CONFIGURE_ARGS+= \  
--with-mysql  
else  
CONFIGURE_ARGS+= \  
--without-mysql  
endif  
 
ifneq ($(SDK)$(CONFIG_PACKAGE_lighttpd-mod-webdav),)  
CONFIGURE_ARGS+= \  
--with-webdav-locks \  
--with-webdav-props  
# XXX: needed by sqlite3 to prevent segfaults in mod_webdav.so  
CONFIGURE_VARS+= \  
LIBS="-lpthread"  
else  
CONFIGURE_ARGS+= \  
--without-webdav-locks \  
--without-webdav-props  
endif  
 
define Build/Configure  
$(call Build/Configure/Default)  
# XXX: override pcre (mis)detection by ./configure when cross-compiling  
echo "#define HAVE_LIBPCRE 1" >>$(PKG_BUILD_DIR)/config.h  
echo "#define HAVE_PCRE_H 1" >>$(PKG_BUILD_DIR)/config.h  
endef  
 
define Package/lighttpd/conffiles  
/etc/lighttpd/lighttpd.conf  
endef  
 
define Package/lighttpd/install  
$(INSTALL_DIR) $(1)/etc/lighttpd  
$(INSTALL_DATA) ./files/lighttpd.conf $(1)/etc/lighttpd/  
$(INSTALL_DATA) $(PKG_BUILD_DIR)/doc/config/conf.d/mime.conf $(1)/etc/lighttpd/  
$(INSTALL_DIR) $(1)/etc/lighttpd/conf.d  
$(INSTALL_DIR) $(1)/etc/init.d  
$(INSTALL_BIN) ./files/lighttpd.init $(1)/etc/init.d/lighttpd  
$(INSTALL_DIR) $(1)/usr/lib/lighttpd  
for m in dirlisting indexfile staticfile; do \  
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lighttpd/mod_$$$${m}.so $(1)/usr/lib/lighttpd/ ; \  
done  
$(INSTALL_DIR) $(1)/usr/sbin  
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/lighttpd $(1)/usr/sbin/  
endef  
 
define BuildPlugin  
define Package/lighttpd-mod-$(1)  
$(call Package/lighttpd/Default)  
DEPENDS:=lighttpd  
ifneq ($(3),)  
DEPENDS+= $(3)  
endif  
TITLE:=$(2) module  
endef  
 
define Package/lighttpd-mod-$(1)/install  
$(INSTALL_DIR) $$(1)/usr/lib/lighttpd  
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lighttpd/mod_$(1).so $$(1)/usr/lib/lighttpd  
$(INSTALL_DIR) $$(1)/etc/lighttpd/conf.d  
if [ -f $(PKG_BUILD_DIR)/doc/config/conf.d/$(1).conf ]; then \  
$(CP) $(PKG_BUILD_DIR)/doc/config/conf.d/$(1).conf $$(1)/etc/lighttpd/conf.d/$(4)-$(1).conf ; \  
else \  
echo 'server.modules += ( "mod_$(1)" )' > $$(1)/etc/lighttpd/conf.d/$(4)-$(1).conf ; \  
fi  
endef  
 
$$(eval $$(call BuildPackage,lighttpd-mod-$(1)))  
endef  
 
$(eval $(call BuildPackage,lighttpd))  
$(eval $(call BuildPlugin,access,Access restrictions,,10))  
$(eval $(call BuildPlugin,accesslog,Access logging,,10))  
$(eval $(call BuildPlugin,alias,Directory alias,,10))  
$(eval $(call BuildPlugin,auth,Authentication,,05))  
$(eval $(call BuildPlugin,cgi,CGI,,10))  
$(eval $(call BuildPlugin,cml,Cache Meta Language,,10))  
$(eval $(call BuildPlugin,compress,Compress output,+PACKAGE_lighttpd-mod-compress:zlib,10))  
$(eval $(call BuildPlugin,evasive,Evasive,,10))  
$(eval $(call BuildPlugin,evhost,Exnhanced Virtual-Hosting,,10))  
$(eval $(call BuildPlugin,expire,Expire,,10))  
$(eval $(call BuildPlugin,extforward,Extract client,,10))  
$(eval $(call BuildPlugin,fastcgi,FastCGI,,10))  
$(eval $(call BuildPlugin,flv_streaming,FLV streaming,,10))  
$(eval $(call BuildPlugin,magnet,Magnet,,10))  
$(eval $(call BuildPlugin,mysql_vhost,Mysql virtual hosting,+PACKAGE_lighttpd-mod-mysql_vhost:libmysqlclient,10))  
$(eval $(call BuildPlugin,proxy,Proxy,,10))  
$(eval $(call BuildPlugin,redirect,URL redirection,+PACKAGE_lighttpd-mod-redirect:libpcre,10))  
$(eval $(call BuildPlugin,rewrite,URL rewriting,+PACKAGE_lighttpd-mod-rewrite:libpcre,10))  
$(eval $(call BuildPlugin,rrdtool,RRDtool,,10))  
$(eval $(call BuildPlugin,scgi,SCGI,,10))  
$(eval $(call BuildPlugin,secdownload,Secure and fast download,,10))  
$(eval $(call BuildPlugin,setenv,Environment variable setting,,10))  
$(eval $(call BuildPlugin,simple_vhost,Simple virtual hosting,,10))  
$(eval $(call BuildPlugin,ssi,SSI,+libpcre,10))  
$(eval $(call BuildPlugin,status,Server status display,,10))  
$(eval $(call BuildPlugin,trigger_b4_dl,Trigger before download,+PACKAGE_lighttpd-mod-trigger_b4_dl:libpcre,10))  
$(eval $(call BuildPlugin,userdir,User directory,,10))  
$(eval $(call BuildPlugin,usertrack,User tracking,,10))  
$(eval $(call BuildPlugin,webdav,WebDAV,+PACKAGE_lighttpd-mod-webdav:libsqlite3 +PACKAGE_lighttpd-mod-webdav:libuuid +PACKAGE_lighttpd-mod-webdav:libxml2,10))  
 
 
# lighttpd configuration file  
#  
server.modules = (  
)  
 
### only root can use these options  
#server.chroot = "/"  
 
######### Options that are good to be but not neccesary to be changed #######  
#server.port = 81  
#server.bind = "localhost"  
server.document-root = "/www"  
server.upload-dirs = ( "/tmp" )  
server.errorlog = "/var/log/lighttpd/error.log"  
server.pid-file = "/var/run/lighttpd.pid"  
#server.username = "www-data"  
#server.groupname = "www-data"  
#server.tag = "lighttpd"  
#server.errorlog-use-syslog = "enable"  
#server.network-backend = "write"  
 
index-file.names = ( "index.php", "index.html",  
"index.htm", "default.htm",  
" index.lighttpd.html" )  
 
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )  
 
## Use ipv6 if available  
#include_shell "/usr/share/lighttpd/use-ipv6.pl"  
 
#dir-listing.encoding = "utf-8"  
#server.dir-listing = "enable"  
 
include "/etc/lighttpd/mime.conf"  
include_shell "cat /etc/lighttpd/conf.d/*.conf"  
 
 
 
 
#!/bin/sh /etc/rc.common  
# Copyright (C) 2006-2011 OpenWrt.org  
 
SERVICE_USE_PID=1  
 
START=50  
 
start() {  
mkdir -m 0755 -p /var/log/lighttpd  
service_start /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf  
}  
 
stop() {  
service_stop /usr/sbin/lighttpd  
}  
 
 
file:a/net/prosody/Makefile (deleted)
#  
# Copyright (C) 2009-2011 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:=prosody  
PKG_VERSION:=0.6.2  
PKG_RELEASE:=2  
 
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz  
PKG_SOURCE_URL:=http://prosody.im/downloads/source  
PKG_MD5SUM:=5da59bc906419ad3b4faa21516a6ca18  
 
PKG_INSTALL:=1  
 
include $(INCLUDE_DIR)/package.mk  
 
define Package/prosody  
SECTION:=net  
CATEGORY:=Network  
SUBMENU:=Instant Messaging  
DEPENDS:=+luafilesystem +libidn +luaexpat +luasec  
TITLE:=XMPP server  
URL:=http://prosody.im/  
endef  
 
define Package/prosody/description  
Prosody is an exciting new server for Jabber/XMPP  
written in Lua. It aims to be easy to use, and light  
on resources  
endef  
 
define Package/prosody/conffiles  
/etc/prosody/prosody.cfg.lua  
endef  
 
TARGET_CFLAGS += $(FPIC)  
 
define Build/Configure  
# this is *NOT* GNU autoconf stuff  
(cd $(PKG_BUILD_DIR); ./configure \  
--prefix=/usr \  
--with-lua="$(STAGING_DIR)/host/bin" \  
--with-lua-include="$(STAGING_DIR)/usr/include" \  
--with-lua-lib="$(STAGING_DIR)/usr/lib" \  
--cflags="$(TARGET_CFLAGS)" \  
--datadir="/etc/prosody/data" \  
)  
endef  
 
MAKE_FLAGS += \  
CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -std=gnu99" \  
LDFLAGS="$(TARGET_LDFLAGS)" \  
PREFIX="/usr" \  
 
define Package/prosody/install  
$(INSTALL_DIR) $(1)/etc/init.d  
$(INSTALL_BIN) ./files/prosody.init $(1)/etc/init.d/prosody  
$(INSTALL_DIR) $(1)/etc/prosody  
$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/prosody/prosody.cfg.lua $(1)/etc/prosody/  
$(INSTALL_DIR) $(1)/etc/prosody/certs  
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/prosody/certs/localhost.{cert,key} $(1)/etc/prosody/certs/  
$(INSTALL_DIR) $(1)/etc/prosody/data  
$(INSTALL_DIR) $(1)/usr/bin  
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/prosody{,ctl} $(1)/usr/bin/  
$(INSTALL_DIR) $(1)/usr/lib/prosody  
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/prosody/prosody.version $(1)/usr/lib/prosody/  
$(INSTALL_DIR) $(1)/usr/lib/prosody/core  
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/core/*.lua $(1)/usr/lib/prosody/core/  
$(INSTALL_DIR) $(1)/usr/lib/prosody/fallbacks  
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/fallbacks/*.lua $(1)/usr/lib/prosody/fallbacks/  
$(INSTALL_DIR) $(1)/usr/lib/prosody/modules  
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/modules/*.lua $(1)/usr/lib/prosody/modules/  
$(INSTALL_DIR) $(1)/usr/lib/prosody/modules/muc  
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/modules/muc/*.lua $(1)/usr/lib/prosody/modules/muc/  
$(INSTALL_DIR) $(1)/usr/lib/prosody/net  
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/net/*.lua $(1)/usr/lib/prosody/net/  
$(INSTALL_DIR) $(1)/usr/lib/prosody/util  
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/util/*.lua $(1)/usr/lib/prosody/util/  
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/prosody/util/*.so $(1)/usr/lib/prosody/util/  
endef  
 
$(eval $(call BuildPackage,prosody))  
 
#!/bin/sh /etc/rc.common  
# Copyright (C) 2010-2011 OpenWrt.org  
 
START=99  
 
EXTRA_COMMANDS="status"  
EXTRA_HELP=" status Print the status of the service"  
 
BIN=/usr/bin/prosodyctl  
LOG_D=/var/log/prosody  
RUN_D=/var/run/prosody  
PID_F=$RUN_D/prosody.pid  
RUN_USER=prosody  
RUN_GROUP=prosody  
 
start() {  
user_exists prosody 54 || user_add prosody 54  
group_exists prosody 54 || group_add prosody 54  
[ -d /var/run/prosody ] || {  
mkdir -m 0755 -p /var/run/prosody  
chown prosody:prosody /var/run/prosody  
}  
[ -d /var/log/prosody ] || {  
mkdir -m 0755 -p /var/log/prosody  
chown prosody:prosody /var/log/prosody  
}  
 
$BIN start  
}  
 
stop() {  
$BIN stop  
}  
 
reload() {  
[ -f $PID_F ] && kill -HUP $(cat $PID_F)  
}  
 
status() {  
$BIN status  
}  
 
--- a/prosody.cfg.lua.dist  
+++ b/prosody.cfg.lua.dist  
@@ -47,7 +47,7 @@ modules_enabled = {  
"register"; -- Allow users to register on this server using a client and change passwords  
 
-- Other specific functionality  
- --"posix"; -- POSIX functionality, sends server to background, enables syslog, etc.  
+ "posix"; -- POSIX functionality, sends server to background, enables syslog, etc.  
--"console"; -- Opens admin telnet interface on localhost port 5582  
--"bosh"; -- Enable BOSH clients, aka "Jabber over HTTP"  
--"httpserver"; -- Serve static files from a directory over HTTP  
@@ -65,6 +65,9 @@ modules_disabled = {  
-- Disable account creation by default, for security  
-- For more information see http://prosody.im/doc/creating_accounts  
allow_registration = false;  
+  
+-- File to write pid in  
+pidfile = "/var/run/prosody/prosody.pid";  
 
-- These are the SSL/TLS-related settings. If you don't want  
-- to use SSL/TLS, you may comment or remove this  
@@ -73,6 +76,15 @@ ssl = {  
certificate = "certs/localhost.cert";  
}  
 
+-- Errors to syslog  
+-- All to /var/log/prosody/  
+log = {  
+ { levels = { "error" }; to = "syslog"; };  
+ { levels = { "error" }; to = "file"; filename = "/var/log/prosody/prosody.err"; };  
+ -- Change "info" to "debug" for more verbose logging  
+ { levels = { min = "info" }; to = "file"; filename = "/var/log/prosody/prosody.log"; };  
+}  
+  
----------- Virtual hosts -----------  
-- You need to add a VirtualHost entry for each domain you wish Prosody to serve.  
-- Settings under each VirtualHost entry apply *only* to that host.  
 
file:a/net/znc/Makefile (deleted)
#  
# Copyright (C) 2009-2010 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:=znc  
PKG_VERSION:=1.2  
PKG_RELEASE:=1  
 
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz  
PKG_SOURCE_URL:=http://znc.in/releases \  
http://znc.in/releases/archive  
PKG_MD5SUM:=ef18e5402a82cc3fcab5c2ac5c2e6f3b  
 
PKG_BUILD_PARALLEL:=1  
 
 
define Package/znc/default  
SUBMENU:=Instant Messaging  
SECTION:=net  
CATEGORY:=Network  
TITLE:=ZNC  
URL:=http://en.znc.in/  
MAINTAINER:=Jonas Gorski <jogo@openwrt.org>  
endef  
 
define Package/znc  
$(Package/znc/default)  
DEPENDS:=+libopenssl +libpthread $(CXX_DEPENDS)  
MENU:=1  
endef  
 
define Package/znc/description  
ZNC is an IRC bouncer with many advanced features like detaching,  
multiple users, per channel playback buffer, SSL, IPv6, transparent DCC  
bouncing, and c++ module support to name a few.  
endef  
 
define Package/znc/conffiles  
/etc/config/znc  
endef  
 
 
define Package/znc/install  
$(INSTALL_DIR) $(1)/usr/bin  
$(INSTALL_BIN) $(PKG_BUILD_DIR)/znc $(1)/usr/bin/  
$(INSTALL_DIR) $(1)/etc/init.d  
$(INSTALL_BIN) ./files/znc.init $(1)/etc/init.d/znc  
$(INSTALL_DIR) $(1)/etc/config  
$(INSTALL_DATA) ./files/znc.conf $(1)/etc/config/znc  
$(INSTALL_DIR) $(1)/usr/lib/znc/  
$(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/droproot.so $(1)/usr/lib/znc/  
endef  
 
 
ZNC_MODULES :=  
ZNC_MODULE_TARGETS := droproot.so  
 
define module  
define Package/znc-mod-$(strip $(1))  
$(Package/znc/default)  
TITLE+= ($(strip $(1)) plugin)  
DEPENDS:=znc  
endef  
 
define Package/znc-mod-$(strip $(1))/description  
$(strip $(2))  
endef  
 
define Package/znc-mod-$(strip $(1))/install  
$(INSTALL_DIR) $$(1)/usr/lib/znc/  
$(INSTALL_BIN) $$(PKG_BUILD_DIR)/modules/$(subst -,_,$(strip $(1))).so $$(1)/usr/lib/znc/  
# include webadmin page templates if existing  
if [ -d $$(PKG_BUILD_DIR)/modules/data/$(subst -,_,$(strip $(1))) ]; then \  
$(INSTALL_DIR) $$(1)/usr/share/znc/modules ;\  
$(CP) -r $$(PKG_BUILD_DIR)/modules/data/$(subst -,_,$(strip $(1))) $$(1)/usr/share/znc/modules ;\  
fi  
endef  
 
ZNC_MODULES += znc-mod-$(strip $(1))  
$(if $(CONFIG_PACKAGE_znc-mod-$(strip $(1))),ZNC_MODULE_TARGETS += $(subst -,_,$(strip $(1))).so)  
endef  
 
define webadmin  
define Package/znc-mod-webadmin  
$(Package/znc/default)  
TITLE+= (webadmin plugin)  
DEPENDS:=znc  
endef  
 
define Package/znc-mod-webadmin/description  
Allows you to add/remove/edit users and settings on the fly via a web browser.  
endef  
 
define Package/znc-mod-webadmin/install  
$(INSTALL_DIR) $$(1)/usr/lib/znc/  
$(INSTALL_BIN) $$(PKG_BUILD_DIR)/modules/webadmin.so $$(1)/usr/lib/znc/  
$(INSTALL_DIR) $$(1)/usr/share/znc/modules  
$(CP) -r $$(PKG_BUILD_DIR)/modules/data/webadmin $$(1)/usr/share/znc/modules  
$(INSTALL_DIR) $$(1)/usr/share/znc/webskins/  
$(CP) -r $$(PKG_BUILD_DIR)/webskins/_default_ $$(1)/usr/share/znc/webskins/  
endef  
 
ZNC_MODULES += znc-mod-webadmin  
$(if $(CONFIG_PACKAGE_znc-mod-webadmin),ZNC_MODULE_TARGETS += webadmin.so)  
endef  
 
define webskin  
define Package/znc-webskin-$(strip $(1))  
$(Package/znc/default)  
TITLE+= ($(strip $(1)) webskin)  
DEPENDS:=znc-mod-webadmin  
endef  
 
define Package/znc-webskin-$(strip $(1))/description  
$(strip $(1)) webskin for webadmin  
endef  
 
define Package/znc-webskin-$(strip $(1))/install  
$(INSTALL_DIR) $$(1)/usr/share/znc/webskins/  
$(CP) -r $$(PKG_BUILD_DIR)/webskins/$(strip $(1)) $$(1)/usr/share/znc/webskins/  
endef  
ZNC_MODULES += znc-webskin-$(strip $(1))  
endef  
 
, := ,  
 
$(eval $(call module,adminlog,Log user connects and disconnects and failed \  
logins to file or syslog.))  
 
$(eval $(call module,autoattach,Reattaches you to channels on activity.))  
 
$(eval $(call module,autocycle,Cycles a channel when you are the only one in \  
there and you don't have op.))  
 
$(eval $(call module,autoop,Auto op the good guys.))  
 
$(eval $(call module,autoreply,Gives a automatic reply if someone messages you \  
if you are away.))  
 
$(eval $(call module,autovoice,Autovoices everyone who joins some channel.))  
 
$(eval $(call module,awaynick,Change your nick while you are away.))  
 
$(eval $(call module,awaystore,Stores messages while away$(,) also auto away.))  
 
$(eval $(call module,block-motd,This module blocks the server's Message of the \  
Day.))  
 
$(eval $(call module,blockuser,Blocks certain users from using ZNC saying \  
their account was disabled.))  
 
$(eval $(call module,bouncedcc,Bounces dcc transfers through the znc server \  
instead of sending them directly to the user.))  
 
$(eval $(call module,buffextras,Add nick changes$(,) joins$(,) parts$(,) topic \  
changes etc. to your playback buffer.))  
 
$(eval $(call module,cert,Use a SSL certificate for connecting to a server.))  
 
$(eval $(call module,certauth,This module allows users to log in to ZNC via \  
SSL client keys.))  
 
$(eval $(call module,chansaver,Keeping config up to date when user joins and \  
parts.))  
 
$(eval $(call module,clearbufferonmsg,This module keeps the buffer until the \  
next message from the client.))  
 
$(eval $(call module,clientnotify,Notify about new incoming connections to \  
your user.))  
 
$(eval $(call module,controlpanel,Allows you to add/remove/edit users and \  
settings on the fly via IRC messages.))  
 
$(eval $(call module,crypt,Encryption for channel/private messages.))  
 
$(eval $(call module,ctcpflood,This module tries to block ctcp floods.))  
 
$(eval $(call module,dcc,Allows you to transfer files to and from ZNC.))  
 
$(eval $(call module,disconkick,This module will kick your client from all \  
channels where you are$(,) in case if ZNC disconnects from server.))  
 
$(eval $(call module,fail2ban,Block IPs for some time after a failed login.))  
 
$(eval $(call module,flooddetach,This module detaches you from channels which \  
are flooded.))  
 
$(eval $(call module,identfile,Places the ident of a user to a file when they \  
are trying to connect.))  
 
$(eval $(call module,keepnick,Tries to get you your primary nick.))  
 
$(eval $(call module,kickrejoin,Implements auto-rejoin-on-kick.))  
 
$(eval $(call module,lastseen,Logs when a user last logged in to ZNC.))  
 
$(eval $(call module,listsockets,This module displays a list of all open \  
sockets in ZNC.))  
 
$(eval $(call module,log,Log conversations to file.))  
 
$(eval $(call module,modules_online,This module fakes the online status of \  
ZNC-*users.))  
 
$(eval $(call module,nickserv,Auths you with NickServ.))  
 
$(eval $(call module,notes,This modules stores and displays short notes using \  
a key/note pairs and shows them to you on connect.))  
 
$(eval $(call module,notify-connect,Sends a notice to all admins when a user \  
logs in or out.))  
 
$(eval $(call module,partyline,Allows ZNC users to join internal channels and \  
query other ZNC users on the same ZNC.))  
 
$(eval $(call module,perform,Performs commands on connect.))  
 
$(eval $(call module,q,Auths you with Q (and a little more).))  
 
$(eval $(call module,raw,View all of the raw traffic.))  
 
$(eval $(call module,route-replies,Routes back answers to the right client \  
when connected with multiple clients.))  
 
$(eval $(call module,sasl,The SASL module allows you to authenticate to an \  
IRC network via SASL.))  
 
$(eval $(call module,savebuff,Saves your channel buffers into an encrypted \  
file so they can survive restarts and reboots.))  
 
$(eval $(call module,schat,SSL (encrypted) DCC chats.))  
 
$(eval $(call module,send-raw,Allows you to send raw traffic to IRC from \  
other users.))  
 
$(eval $(call module,simple-away,This module will automatically set you away \  
on IRC while you are disconnected from the bouncer.))  
 
$(eval $(call module,shell,Have your unix shell in a query window right inside \  
of your IRC client.))  
 
$(eval $(call module,stickychan,Keeps you sticked to specific channels.))  
 
$(eval $(call module,watch,Monitor activity for specific text patterns from \  
specific users and have the text sent to a special query window.))  
 
$(eval $(call webadmin))  
 
$(eval $(call webskin,dark-clouds))  
$(eval $(call webskin,forest))  
$(eval $(call webskin,ice))  
 
PKG_CONFIG_DEPENDS := $(patsubst %,CONFIG_PACKAGE_%,$(ZNC_MODULES))  
 
include $(INCLUDE_DIR)/uclibc++.mk  
include $(INCLUDE_DIR)/package.mk  
 
CONFIGURE_VARS += \  
CXXFLAGS="$(TARGET_CFLAGS) -fno-builtin -fno-rtti -nostdinc++" \  
CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \  
LDFLAGS="-nodefaultlibs -lc -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \  
LIBS="-luClibc++ -lm -lssl -lcrypto $(LIBGCC_S) -lc"  
 
CONFIGURE_ARGS += \  
--disable-c-ares \  
--disable-perl  
 
define Build/Configure  
$(call Build/Configure/Default,)  
$(call libtool_disable_rpath)  
endef  
 
define Build/Compile  
$(call Build/Compile/Default,znc)  
+$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/modules \  
$(MAKE_FLAGS) $(ZNC_MODULE_TARGETS)  
endef  
 
$(eval $(call BuildPackage,znc))  
$(foreach m,$(ZNC_MODULES),$(eval $(call BuildPackage,$(m))))  
 
file:a/net/znc/files/znc.conf (deleted)
config znc  
# where to listen for connections  
list listener '192.168.1.1 1234'  
# If using SSL sockets, use the following certifcate:  
# option znc_ssl_cert '/etc/znc.cert'  
 
# load global modules (You need to install them first):  
# list module 'fail2ban'  
 
# remove this to enable the service  
option disabled 1  
 
config user 'sampleUser'  
# Use either a plain text password or use the full sha256#... line.  
# You can generate one with 'znc -s'.  
option password 'changeme'  
option nick 'sampleUser'  
option altnick 'userSample'  
option ident 'openwrt'  
option realname 'John Doe'  
 
# This adds support for channels in znc configuration:  
# list channel '#chan optional_password'  
 
# list of allowed servers:  
# list server 'chat.freenode.net 6667'  
 
# load user modules ('<module> [params...]'):  
# list module 'simple_away -timer 10 disconnected'  
 
file:a/net/znc/files/znc.init (deleted)
#!/bin/sh /etc/rc.common  
# Copyright (C) 2010 Openwrt.org  
 
START=60  
 
ZNC_CONFIG_PATH=/tmp/etc/znc  
PID_FILE=${ZNC_CONFIG_PATH}/znc.pid  
ZNC_CONFIG=${ZNC_CONFIG_PATH}/configs/znc.conf  
 
EXTERNAL_CONFIG=0  
DISABLED=  
 
RUNAS_USER=  
RUNAS_GROUP=  
 
add_param() {  
echo "$1 = $2" >> $ZNC_CONFIG  
}  
 
add_chan() {  
chan=${1% *}  
pass=${1#* }  
echo " <Chan $chan>" >> $ZNC_CONFIG  
[ "$chan" != "$pass" ] && echo " Key = $pass" >> $ZNC_CONFIG  
echo " </Chan>" >> $ZNC_CONFIG  
}  
 
add_network() {  
local current_user="$1"  
local network="$2"  
local user  
local name  
 
config_get user "$network" user  
 
[ "$user" = "$current_user" ] || return 0  
 
config_get name "$network" name  
echo " <Network $name>" >> $ZNC_CONFIG  
config_list_foreach "$network" server "add_param \" Server\""  
config_list_foreach "$network" channel "add_chan"  
}  
 
znc_global() {  
local znc="$1"  
local anoniplimit  
local maxbuffersize  
local connectdelay  
local serverthrottle  
local znc_config_path  
local znc_pem_file  
 
config_get_bool DISABLED "$znc" disabled 0  
 
[ "$DISABLED" -eq 0 ] || return 0  
 
config_get znc_config_path "$znc" znc_config_path  
 
config_get RUNAS_USER "$znc" runas_user  
config_get RUNAS_GROUP "$znc" runas_group  
 
if [ "${znc_config_path}" ]  
then  
ZNC_CONFIG_PATH=$znc_config_path  
EXTERNAL_CONFIG=1  
else  
mkdir -p $ZNC_CONFIG_PATH/configs/  
[ ! -f "$ZNC_CONFIG" ] || rm "$ZNC_CONFIG"  
 
add_param "Version" "1.0"  
 
config_get anoniplimit "$znc" anoniplimit  
config_get maxbuffersize "$znc" maxbuffersize  
config_get connectdelay "$znc" connectdelay  
config_get serverthrottle "$znc" serverthrottle  
config_get znc_pem_file "$znc" znc_ssl_cert  
 
[ -z "$znc_pem_file" ] || ln -sf "$znc_pem_file" $ZNC_CONFIG_PATH/znc.pem  
 
[ -z $anoniplimit ] || echo "AnonIPLimit = $anoniplimit" >> $ZNC_CONFIG  
[ -z $maxbuffersize ] || echo "MaxBufferSize = $maxbuffersize" >> $ZNC_CONFIG  
[ -z $connectdelay ] || echo "ConnectDelay = $connectdelay" >> $ZNC_CONFIG  
[ -z $serverthrottle ] || echo "ServerThrottle = $anoniplimit" >> $ZNC_CONFIG  
 
echo "PidFile = $PID_FILE" >> $ZNC_CONFIG  
 
config_list_foreach "$znc" listener "add_param Listener"  
config_list_foreach "$znc" module "add_param LoadModule"  
 
add_param LoadModule "droproot ${RUNAS_USER:-nobody} ${RUNAS_GROUP:-nogroup}"  
fi  
}  
 
add_user() {  
local user="$1"  
local password  
local nick  
local altnick  
local ident  
local realname  
local buffer  
local quitmsg  
local chanmodes  
local vhost  
local server  
 
config_get password "$user" password  
config_get nick "$user" nick  
config_get altnick "$user" altnick  
config_get ident "$user" ident  
config_get realname "$user" realname  
config_get buffer "$user" buffer  
config_get quitmsg "$user" quitmsg  
config_get chanmodes "$user" chanmodes  
config_get vhost "$user" vhost  
config_get server "$user" server  
 
echo "<User $user>" >> $ZNC_CONFIG  
 
case "$password" in  
"md5#"* | "sha256#"* | "plain#"*)  
add_param " Pass" "$password"  
;;  
*)  
add_param " Pass" "plain#$password"  
;;  
esac  
 
add_param " Nick" "$nick"  
add_param " AltNick" "${altnick:-$nick"_"}"  
add_param " Ident" "${ident:-$nick}"  
add_param " RealName" "${realname:-$nick}"  
[ -z "$vhost" ] || add_param " VHost" "$vhost"  
add_param " Buffer" "${buffer:-50}"  
add_param " KeepBuffer" "false"  
add_param " ChanModes" "${chanmodes:-"+stn"}"  
[ -z "$quitmsg" ] || add_param " QuitMsg" "$quitmsg"  
 
config_list_foreach "$user" module "add_param \" LoadModule\""  
 
# add legacy network  
if [ "$server" ]; then  
echo " <Network Default>" >> $ZNC_CONFIG  
config_list_foreach "$user" server "add_param \" Server\""  
config_list_foreach "$user" channel "add_chan"  
echo " </Network>" >> $ZNC_CONFIG  
fi  
 
config_foreach "add_network \"$user\"" network  
 
echo "</User>" >> $ZNC_CONFIG  
}  
 
 
start() {  
config_load znc  
config_foreach znc_global znc  
 
if [ "$DISABLED" -eq 1 ]; then  
return 0  
fi  
 
if [ "$EXTERNAL_CONFIG" -eq 0 ]  
then  
config_foreach add_listener listener  
config_foreach add_user user  
 
chown -hR ${RUNAS_USER:-nobody}:${RUNAS_GROUP:-nogroup} /tmp/etc/znc  
fi  
 
if [ "$EXTERNAL_CONFIG" -eq 1 -a "$RUNAS_USER" ]  
then  
local SU=$(which su)  
if [ "$SU" ]  
then  
$SU -c "/usr/bin/znc -d$ZNC_CONFIG_PATH >/dev/null &" $RUNAS_USER  
else  
logger -s -t ZNC -p daemon.err "Could not run ZNC as user $RUNAS_USER: su not found."  
exit 1  
fi  
else  
/usr/bin/znc -d$ZNC_CONFIG_PATH >/dev/null &  
fi  
}  
 
stop() {  
if [ -f "$PID_FILE" ]  
then  
kill $(cat "$PID_FILE")  
else  
killall znc  
fi  
}  
 
 
From 5f655f9a25a377c01cb15517859eb514628a43d4 Mon Sep 17 00:00:00 2001  
From: Jonas Gorski <jonas.gorski+openwrt@gmail.com>  
Date: Wed, 6 Apr 2011 04:10:23 +0200  
Subject: [PATCH] Move the root check to after config parsing  
 
---  
src/main.cpp | 27 ++++++++++++++-------------  
1 files changed, 14 insertions(+), 13 deletions(-)  
 
--- a/src/main.cpp  
+++ b/src/main.cpp  
@@ -243,19 +243,6 @@ int main(int argc, char** argv) {  
CUtils::PrintStatus(true, "");  
}  
 
- if (isRoot()) {  
- CUtils::PrintError("You are running ZNC as root! Don't do that! There are not many valid");  
- CUtils::PrintError("reasons for this and it can, in theory, cause great damage!");  
- if (!bAllowRoot) {  
- delete pZNC;  
- return 1;  
- }  
- CUtils::PrintError("You have been warned.");  
- CUtils::PrintError("Hit CTRL+C now if you don't want to run ZNC as root.");  
- CUtils::PrintError("ZNC will start in 30 seconds.");  
- sleep(30);  
- }  
-  
if (bMakeConf) {  
if (!pZNC->WriteNewConfig(sConfig)) {  
delete pZNC;  
@@ -276,6 +263,20 @@ int main(int argc, char** argv) {  
return 1;  
}  
 
+ if (isRoot()) {  
+ CUtils::PrintError("You are running ZNC as root! Don't do that! There are not many valid");  
+ CUtils::PrintError("reasons for this and it can, in theory, cause great damage!");  
+ if (!bAllowRoot) {  
+ delete pZNC;  
+ return 1;  
+ }  
+ CUtils::PrintError("You have been warned.");  
+ CUtils::PrintError("Hit CTRL+C now if you don't want to run ZNC as root.");  
+ CUtils::PrintError("ZNC will start in 30 seconds.");  
+ sleep(30);  
+ }  
+  
+  
if (bForeground) {  
int iPid = getpid();  
CUtils::PrintMessage("Staying open for debugging [pid: " + CString(iPid) + "]");  
 
From fa14938321eda39f16bee6068296e6abc9df7b85 Mon Sep 17 00:00:00 2001  
From: Jonas Gorski <jonas.gorski+openwrt@gmail.com>  
Date: Wed, 6 Apr 2011 04:11:48 +0200  
Subject: [PATCH] Add a uClibc++ build workaround  
 
---  
modules/webadmin.cpp | 4 +++-  
1 files changed, 3 insertions(+), 1 deletions(-)  
 
--- a/modules/webadmin.cpp  
+++ b/modules/webadmin.cpp  
@@ -20,6 +20,7 @@  
#include <znc/IRCNetwork.h>  
#include <znc/IRCSock.h>  
 
+using std::string;  
using std::stringstream;  
using std::make_pair;  
using std::set;  
@@ -75,7 +76,7 @@ class CWebAdminMod : public CModule {  
public:  
MODCONSTRUCTOR(CWebAdminMod) {  
VPair vParams;  
- vParams.push_back(make_pair("user", ""));  
+ vParams.push_back(make_pair((string)"user", (string)""));  
AddSubPage(new CWebSubPage("settings", "Global Settings", CWebSubPage::F_ADMIN));  
AddSubPage(new CWebSubPage("edituser", "Your Settings", vParams));  
AddSubPage(new CWebSubPage("traffic", "Traffic Info", CWebSubPage::F_ADMIN));  
 
From 94aff4c3389111fc85054eb06b40bea26a216d0c Mon Sep 17 00:00:00 2001  
From: Jonas Gorski <jonas.gorski+openwrt@gmail.com>  
Date: Sat, 16 Apr 2011 05:51:04 +0200  
Subject: [PATCH] Don't rebuild everything when the Makefile's timestamp changed  
 
---  
Makefile.in | 2 +-  
modules/Makefile.in | 2 +-  
2 files changed, 2 insertions(+), 2 deletions(-)  
 
--- a/Makefile.in  
+++ b/Makefile.in  
@@ -104,7 +104,7 @@ clean:  
distclean: clean  
rm -rf $(DISTCLEAN)  
 
-src/%.o: src/%.cpp Makefile  
+src/%.o: src/%.cpp  
@mkdir -p .depend src  
$(E) Building core object $*...  
$(Q)$(CXX) $(CXXFLAGS) -c -o $@ $< -MD -MF .depend/$*.dep -MT $@  
--- a/modules/Makefile.in  
+++ b/modules/Makefile.in  
@@ -117,12 +117,12 @@ install_datadir:  
clean:  
rm -rf $(CLEAN)  
 
-%.o: %.cpp Makefile  
+%.o: %.cpp  
@mkdir -p .depend  
$(E) Building module $(notdir $(basename $@))...  
$(Q)$(CXX) $(MODFLAGS) -c -o $@ $< $($(notdir $(basename $@))CXXFLAGS) -MD -MF .depend/$(notdir $@).dep  
 
-%.so: %.o Makefile  
+%.so: %.o  
$(E) "Linking module" $(notdir $(basename $@))...  
$(Q)$(CXX) $(MODFLAGS) $(LDFLAGS) $(MODLINK) -o $@ $< $($(notdir $(basename $@))LDFLAGS) $(LIBS)  
 
 
--- /dev/null  
+++ b/modules/droproot.cpp  
@@ -0,0 +1,144 @@  
+/*  
+ * droproot.cpp  
+ *  
+ * Copyright (c) 2009 Vadtec (vadtec@vadtec.net)  
+ * This program is free software; you can redistribute it and/or modify it  
+ * under the terms of the GNU General Public License version 2 as published  
+ * by the Free Software Foundation.  
+ *  
+ * Copyright (C) 2004-2012 See the AUTHORS file for details.  
+ *  
+ * This program is free software; you can redistribute it and/or modify it  
+ * under the terms of the GNU General Public License version 2 as published  
+ * by the Free Software Foundation.  
+ */  
+  
+#include <znc/znc.h>  
+#include <znc/User.h>  
+#include <pwd.h>  
+#include <grp.h>  
+  
+class CDroproot : public CModule {  
+  
+public:  
+ MODCONSTRUCTOR(CDroproot) {  
+ }  
+  
+ virtual ~CDroproot() {  
+ }  
+  
+ uid_t GetUser(const CString& sUser, CString& sMessage) {  
+ uid_t ret = sUser.ToUInt();  
+  
+ if (ret != 0)  
+ return ret;  
+  
+ struct passwd *pUser = getpwnam(sUser.c_str());  
+  
+ if (!pUser) {  
+ sMessage = "User [" + sUser + "] not found!";  
+ return 0;  
+ }  
+  
+ return pUser->pw_uid;  
+ }  
+  
+ gid_t GetGroup(const CString& sGroup, CString& sMessage) {  
+ gid_t ret = sGroup.ToUInt();  
+  
+ if (ret != 0)  
+ return ret;  
+  
+ struct group *pGroup = getgrnam(sGroup.c_str());  
+  
+ if (!pGroup) {  
+ sMessage = "Group [" + sGroup + "] not found!";  
+ return 0;  
+ }  
+  
+ return pGroup->gr_gid;  
+ }  
+  
+ virtual bool OnLoad(const CString& sArgs, CString& sMessage) {  
+ CString sUser = sArgs.Token(0);  
+ CString sGroup = sArgs.Token(1, true);  
+  
+ if (sUser.empty() || sGroup.empty()) {  
+ sMessage = "Usage: LoadModule = Droproot <uid> <gid>";  
+ return false;  
+ }  
+  
+ m_user = GetUser(sUser, sMessage);  
+  
+ if (m_user == 0) {  
+ sMessage  
+ = "Error: Cannot run as root, check your config file | Useage: LoadModule = Droproot <uid> <gid>";  
+ return false;  
+ }  
+  
+ m_group = GetGroup(sGroup, sMessage);  
+  
+ if (m_group == 0) {  
+ sMessage  
+ = "Error: Cannot run as root, check your config file | Useage: LoadModule = Droproot <uid> <gid>";  
+ return false;  
+ }  
+  
+ return true;  
+ }  
+  
+ virtual bool OnBoot() {  
+ int u, eu, g, eg, sg;  
+  
+ if ((geteuid() == 0) || (getuid() == 0) || (getegid() == 0) || (getgid()  
+ == 0)) {  
+  
+ CUtils::PrintAction("Dropping root permissions");  
+  
+ // Clear all the supplementary groups  
+ sg = setgroups(0, NULL);  
+  
+ if (sg < 0) {  
+ CUtils::PrintStatus(false,  
+ "Could not remove supplementary groups! ["  
+ + CString(strerror(errno)) + "]");  
+  
+ return false;  
+ }  
+  
+ // Set the group (if we are root, this sets all three group IDs)  
+ g = setgid(m_group);  
+ eg = setegid(m_group);  
+  
+ if ((g < 0) || (eg < 0)) {  
+ CUtils::PrintStatus(false, "Could not switch group id! ["  
+ + CString(strerror(errno)) + "]");  
+  
+ return false;  
+ }  
+  
+ // and set the user (if we are root, this sets all three user IDs)  
+ u = setuid(m_user);  
+ eu = seteuid(m_user);  
+  
+ if ((u < 0) || (eu < 0)) {  
+ CUtils::PrintStatus(false, "Could not switch user id! ["  
+ + CString(strerror(errno)) + "]");  
+  
+ return false;  
+ }  
+  
+ CUtils::PrintStatus(true);  
+  
+ return true;  
+ }  
+  
+ return true;  
+ }  
+  
+protected:  
+ uid_t m_user;  
+ gid_t m_group;  
+};  
+  
+GLOBALMODULEDEFS(CDroproot, "Allows ZNC to drop root privileges and run as an un-privileged user.")  
 
file:a/utils/ccrypt/Makefile (deleted)
#  
# Copyright (C) 2009-2010 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:=ccrypt  
PKG_VERSION:=1.10  
PKG_RELEASE:=1  
 
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz  
PKG_SOURCE_URL:=@SF/ccrypt  
PKG_MD5SUM:=44ddd763465c254df83f5d38851d04d7  
 
PKG_FIXUP:=autoreconf  
 
include $(INCLUDE_DIR)/package.mk  
 
define Package/ccrypt  
SECTION:=utils  
CATEGORY:=Utilities  
TITLE:=ccrypt is a utility for encrypting and decrypting files and streams  
URL:=http://ccrypt.sourceforge.net/  
endef  
 
define Package/ccrypt/install  
$(INSTALL_DIR) $(1)/usr/bin  
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ccrypt $(1)/usr/bin/  
ln -s ccrypt $(1)/usr/bin/ccencrypt  
ln -s ccrypt $(1)/usr/bin/ccdecrypt  
ln -s ccrypt $(1)/usr/bin/ccat  
endef  
 
$(eval $(call BuildPackage,ccrypt))  
 
--- a/configure.ac  
+++ b/configure.ac  
@@ -123,17 +123,6 @@ AC_MSG_RESULT($UINT32_TYPE)  
AC_DEFINE_UNQUOTED(UINT32_TYPE,$UINT32_TYPE,unsigned 32 bit integer type)  
 
dnl ----------------------------------------------------------------------  
-dnl Internationalization  
-  
-GETTEXT_PACKAGE=ccrypt  
-AC_SUBST(GETTEXT_PACKAGE)  
-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext])  
-  
-AM_GNU_GETTEXT  
-AM_GNU_GETTEXT_VERSION([0.14.3])  
-IT_PO_SUBDIR(po)  
-  
-dnl ----------------------------------------------------------------------  
dnl Libtool (needed by intl/)  
 
LT_INIT  
@@ -153,9 +142,7 @@ AC_SUBST(TAR)  
dnl ----------------------------------------------------------------------  
AC_CONFIG_FILES([doc/ccrypt.1  
doc/ccguess.1  
- po/Makefile.in  
m4/Makefile  
- intl/Makefile  
Makefile  
src/Makefile  
emacs/Makefile  
--- a/Makefile.am  
+++ b/Makefile.am  
@@ -4,7 +4,7 @@  
 
## Process this file with automake to produce Makefile.in  
 
-SUBDIRS = m4 po intl src emacs doc check  
+SUBDIRS = m4 src emacs doc check  
 
EXTRA_DIST = m4/ChangeLog config.rpath README-WIN  
 
--- a/Makefile.in  
+++ b/Makefile.in  
@@ -36,7 +36,7 @@ host_triplet = @host@  
subdir = .  
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \  
$(srcdir)/Makefile.in $(srcdir)/config.h.in \  
- $(top_srcdir)/configure $(top_srcdir)/intl/Makefile.in \  
+ $(top_srcdir)/configure \  
ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS config.guess \  
config.rpath config.sub depcomp elisp-comp install-sh \  
ltmain.sh missing mkinstalldirs  
@@ -66,7 +66,7 @@ am__CONFIG_DISTCLEAN_FILES = config.stat  
configure.lineno config.status.lineno  
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs  
CONFIG_HEADER = config.h  
-CONFIG_CLEAN_FILES = intl/Makefile  
+CONFIG_CLEAN_FILES =  
CONFIG_CLEAN_VPATH_FILES =  
SOURCES =  
DIST_SOURCES =  
@@ -277,7 +277,7 @@ target_alias = @target_alias@  
top_build_prefix = @top_build_prefix@  
top_builddir = @top_builddir@  
top_srcdir = @top_srcdir@  
-SUBDIRS = m4 po intl src emacs doc check  
+SUBDIRS = m4 src emacs doc check  
EXTRA_DIST = m4/ChangeLog config.rpath README-WIN  
ACLOCAL_AMFLAGS = -I m4  
all: config.h  
--- a/src/Makefile.am  
+++ b/src/Makefile.am  
@@ -56,4 +56,4 @@ uninstall-local:  
# internationalization stuff  
localedir = $(datadir)/locale  
INCLUDES = -I../intl -I$(top_srcdir)/intl -DLOCALEDIR=\"$(localedir)\"  
-LIBS = @LIBINTL@ @LIBS@  
+LIBS = @LIBS@  
--- a/src/Makefile.in  
+++ b/src/Makefile.in  
@@ -159,7 +159,7 @@ LDFLAGS = @LDFLAGS@  
LIBICONV = @LIBICONV@  
LIBINTL = @LIBINTL@  
LIBOBJS = @LIBOBJS@  
-LIBS = @LIBINTL@ @LIBS@  
+LIBS = @LIBS@  
LIBTOOL = @LIBTOOL@  
LIPO = @LIPO@  
LN_S = @LN_S@  
 
comments