From e8c9ebd05233163f9ae8929530faa0f77cf87bc9 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 26 Mar 2011 21:00:20 +0000 Subject: [PATCH] uci: update to latest version, uses cmake now SVN-Revision: 26307 --- package/uci/Makefile | 28 +++----- package/uci/patches/120-uci_trigger.patch | 80 ++++++++++------------- 2 files changed, 42 insertions(+), 66 deletions(-) diff --git a/package/uci/Makefile b/package/uci/Makefile index bd46864bc2..ffd37a757b 100644 --- a/package/uci/Makefile +++ b/package/uci/Makefile @@ -7,21 +7,23 @@ include $(TOPDIR)/rules.mk -UCI_VERSION=2011-01-19 +UCI_VERSION=2011-03-26 UCI_RELEASE=1 PKG_NAME:=uci PKG_VERSION:=$(UCI_VERSION)$(if $(UCI_RELEASE),.$(UCI_RELEASE)) PKG_RELEASE:=1 -PKG_REV:=a5eb996e0f04d911ff61479508bbc3e17b16ff0c +PKG_REV:=0e8c97eef4aa154543c539b13b5e16859cec8a25 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=git://nbd.name/uci.git PKG_SOURCE_SUBDIR:=uci-$(PKG_VERSION) PKG_SOURCE_VERSION:=$(PKG_REV) PKG_SOURCE_PROTO:=git +PKG_MIRROR_MD5SUM:=d5329ee38167608bfe2d6f758d9250d0 include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk # set to 1 to enable debugging DEBUG= @@ -53,24 +55,12 @@ define Package/libuci-lua TITLE:=Lua plugin for UCI endef -define Build/Configure -endef +TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include +TARGET_LDFLAGS += -L$(STAGING_DIR)/usr/lib -UCI_MAKEOPTS = \ - $(TARGET_CONFIGURE_OPTS) \ - COPTS="$(TARGET_CFLAGS)" \ - DEBUG="$(DEBUG)" \ - VERSION="$(UCI_VERSION)" \ - CPPFLAGS="-I$(PKG_BUILD_DIR) $(TARGET_CPPFLAGS)" \ - FPIC="$(FPIC)" \ - OS="Linux" - -define Build/Compile - $(MAKE) -C $(PKG_BUILD_DIR) $(UCI_MAKEOPTS) - $(MAKE) -C $(PKG_BUILD_DIR)/lua $(UCI_MAKEOPTS) - $(MAKE) -C $(PKG_BUILD_DIR)/trigger $(UCI_MAKEOPTS) \ - LIBS="$(TARGET_LDFLAGS) -L$(PKG_BUILD_DIR) -luci -llua -lcrypt -lm" -endef +CMAKE_OPTIONS = \ + -DLUAPATH=/usr/lib/lua \ + $(if $(DEBUG),-DUCI_DEBUG=ON) define Package/libuci/install $(INSTALL_DIR) $(1)/lib diff --git a/package/uci/patches/120-uci_trigger.patch b/package/uci/patches/120-uci_trigger.patch index 03c3760f91..0b63435a7a 100644 --- a/package/uci/patches/120-uci_trigger.patch +++ b/package/uci/patches/120-uci_trigger.patch @@ -1,51 +1,4 @@ --- /dev/null -+++ b/trigger/Makefile -@@ -0,0 +1,44 @@ -+include ../Makefile.inc -+LUA_VERSION=5.1 -+PREFIX_SEARCH=/usr /usr/local /opt/local -+LUA_PLUGINDIR=$(firstword \ -+ $(foreach ldir,$(subst ;, ,$(shell lua -e 'print(package.cpath)')), \ -+ $(if $(findstring lib/lua/,$(ldir)),$(patsubst %/?.so,%,$(ldir))) \ -+ ) \ -+) -+ -+# find lua prefix -+LUA_PREFIX=$(firstword \ -+ $(foreach prefix,$(PREFIX_SEARCH),\ -+ $(if $(wildcard $(prefix)/include/lua.h),$(prefix)) \ -+ ) \ -+) -+ -+libdir=$(prefix)/libs -+luadir=$(if $(LUA_PLUGINDIR),$(LUA_PLUGINDIR),$(libdir)/lua/$(LUA_VERSION)) -+luainc=$(shell pkg-config --silence-errors --cflags lua$(LUA_VERSION)) -+ -+CPPFLAGS=-I.. $(if $(luainc),$(luainc), -I$(LUA_PREFIX)/include) -+LIBS=-L.. -luci $(shell pkg-config --silence-errors --libs lua$(LUA_VERSION)) -+ -+PLUGIN_LD=$(CC) -+ifeq ($(OS),Darwin) -+ PLUGIN_LDFLAGS=-bundle -+else -+ PLUGIN_LDFLAGS=-shared -Wl,-soname,$(SHLIB_FILE) -+endif -+ -+all: uci_trigger.so -+ -+uci_trigger.so: uci_trigger.o -+ $(PLUGIN_LD) $(PLUGIN_LDFLAGS) -o $@ $^ $(LIBS) -+ -+%.o: %.c -+ $(CC) $(CPPFLAGS) $(CFLAGS) $(FPIC) -c -o $@ $< -+ -+install: -+ mkdir -p $(DESTDIR)$(luadir) -+ $(INSTALL) -m0644 uci_trigger.so $(DESTDIR)$(luadir)/ -+ -+clean: -+ rm -f *.so *.o uci_trigger.so ---- /dev/null +++ b/trigger/uci_trigger.c @@ -0,0 +1,132 @@ +#include @@ -180,3 +133,36 @@ + .attach = trigger_attach, + .detach = trigger_detach, +}; +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -35,6 +35,7 @@ ADD_EXECUTABLE(ucimap-example ucimap-exa + TARGET_LINK_LIBRARIES(ucimap-example uci-static ucimap dl) + + ADD_SUBDIRECTORY(lua) ++ADD_SUBDIRECTORY(trigger) + + INSTALL(FILES uci.h uci_config.h ucimap.h + DESTINATION include/libubox +--- /dev/null ++++ b/trigger/CMakeLists.txt +@@ -0,0 +1,19 @@ ++cmake_minimum_required(VERSION 2.6) ++ ++PROJECT(uci C) ++ ++SET(CMAKE_INSTALL_PREFIX /) ++ ++ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -I..) ++ ++IF(APPLE) ++ SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -undefined dynamic_lookup") ++ENDIF(APPLE) ++ ++ADD_LIBRARY(uci_trigger MODULE uci_trigger.c) ++SET_TARGET_PROPERTIES(uci_trigger PROPERTIES ++ OUTPUT_NAME uci_trigger ++ PREFIX "" ++) ++TARGET_LINK_LIBRARIES(uci_trigger uci) ++ + -- 2.30.2