Hello mazilo,
Thank you very much for taking the time to read my post. I am sorry for the confusion in my explanation. I guess I am equally confused about how to handle the OpenWrt package creating system.
I am trying to build the netopeer multilayer server (https://code.google.com/p/netopeer/). To do so for OpenWrt 12.09, I have had to create three packaging scripts (do you call them that?), which I will briefly explain and post below.
The first is a modification for libssh2 so that the package installs the corresponding pkg-config files and libraries in the staging directory. The packaging Makefile is the following:
#
# Copyright (C) 2012 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libssh2
PKG_VERSION:=1.4.3
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.libssh2.org/download
PKG_MD5SUM:=42e2b3796ac07fc1dbafc7abcc002cd3
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/libssh2
SECTION:=libs
CATEGORY:=Libraries
TITLE:=SSH2 library
URL:=http://www.libssh2.org/
DEPENDS:=+libopenssl +zlib
endef
define Package/libssh2/description
libssh2 is a client-side C library implementing the SSH2 protocol
endef
TARGET_CFLAGS += $(FPIC)
CONFIGURE_ARGS += \
--disable-examples-build \
--with-libssl-prefix=$(STAGING_DIR)/usr
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libssh2.so* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(INSTALL_DATA) \
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libssh2.pc \
$(1)/usr/lib/pkgconfig/
endef
define Package/libssh2/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libssh2.so* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libssh2))
All I did here was include the Build/InstallDev section which wasn't there before. I had to do this because libnetconf, the library that netopeer requires, asks for this dependency.
libnetconf was interesting to package and through a lot of sweat and tears I was able to create a functioning Makefile which I post below:
# Copyright (C) 2013 Jairo Eduardo Lopez Fuentes Nacarino
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id: Makefile $
include $(TOPDIR)/rules.mk
PKG_NAME:=libnetconf
PKG_RELEASE:=1
PKG_VERSION:=0.6.0
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://code.google.com/p/libnetconf
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=a2391bf3427a49682a83dd18d84f322ddef953af
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
# This options makes the buildroot run make install once everything is
# compiled and installs to PKG_INSTALL_DIR
PKG_INSTALL:=1
# This option makes autoreconf run before the configure script
#PKG_FIXUP:=autoreconf
include $(INCLUDE_DIR)/package.mk
define Package/libnetconf
SECTION:=libs
CATEGORY:=Libraries
TITLE:=C Library implementation for IETF NETCONF
URL:=https://code.google.com/p/libnetconf
DEPENDS:=@(!USE_UCLIBC) +libcurl +libxslt +libssh2
MAINTAINER:=Jairo Eduardo Lopez Fuentes Nacarino <jairo@ruri.waseda.jp>
endef
define Package/libnetconf/description
libnetconf is a NETCONF library in C intended for building NETCONF
clients and servers. It provides basic functions to connect NETCONF
client and server to each other via SSH, to send and receive NETCONF
messages and to store and work with the configuration data in a
datastore.
libnetconf implements the NETCONF protocol introduced by IETF.
endef
# NC working directory is usually put in /var which is useless in OpenWrt
CONFIGURE_ARGS+= --with-ncworkingdirpath=/etc/xml/libnetconf
define Package/configure
$(call Build/Configure/Default,$(CONFIGURE_ARGS))
endef
# Provides a library that needs to made available to other packages. Copies
# relevant files into staging directory for later usage. $(1) is for
# $(STAGING_DIR). Apparently $(2) is for $(STAGING_DIR_HOST)
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr
$(CP) $(PKG_INSTALL_DIR)/usr/{bin,lib,include} $(1)/usr/
endef
# If there is not a Package/install section, then the package will not compile
# unless you have an explicit Package/Compile section, which in most cases is
# unnecessary
define Package/libnetconf/install
# Create the directories
$(INSTALL_DIR) $(1)/usr
$(INSTALL_DIR) $(1)/usr/share/libnetconf
$(INSTALL_DIR) $(1)/usr/include/libnetconf
$(INSTALL_DIR) $(1)/etc/xml
$(CP) $(PKG_INSTALL_DIR)/usr/{bin,lib,include} $(1)/usr/
$(CP) $(PKG_INSTALL_DIR)/usr/share/libnetconf/{rnglib,templates,xslt} $(1)/usr/share/libnetconf/
$(CP) $(PKG_INSTALL_DIR)/etc/xml/libnetconf/ $(1)/etc/xml
endef
$(eval $(call BuildPackage,libnetconf))
The final Makefile (script) is netopeer. The interesting thing about netopeer is that it's cloned git repository has the following structure:
netopeer/
netopeer/cli
netopeer/server
netopeer/sever-sl
The netopeer/ directory is empty. netopeer/cli, netopeer/server and netopeer/server-sl are completely independent and have their own configure scripts and Makefiles.
I tried to use the knowledge I obtained from packaging libnetconf but was unsuccessful at configuring, much less compiling. Below is what I have for a working Makefile for packaging:
# Copyright (C) 2013 Jairo Eduardo Lopez Fuentes Nacarino
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id: Makefile $
include $(TOPDIR)/rules.mk
PKG_NAME:=netopeer
PKG_RELEASE:=1
PKG_VERSION:=0.6.0
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://code.google.com/p/netopeer
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=5d6e473ce905f91ae781a41a1b994e59d545e0f8
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/netopeer/Default
SECTION:=net
CATEGORY:=Network
TITLE:=Netopeer NETCONF tools
URL:=https://code.google.com/p/netopeer
DEPENDS:=+libnetconf +dbus +openssh-server
MAINTAINER:=Jairo Eduardo Lopez Fuentes Nacarino <jairo@ruri.waseda.jp>
endef
define Package/netopeer/description
Netopeer is a set of NETCONF tools built on the libnetconf
library. It allows operators to connect to their NETCONF-enabled
devices as well as developers to allow control their devices via
NETCONF.
endef
define Package/netopeer-server-ml
$(call Package/netopeer/Default)
TITLE:=Netopeer NETCONF MultiLevel Server
endef
define Package/netopeer-server-ml/description
netopeer-server-ml provides the multilevel NETCONF server built
on the libnetconf library.
endef
define Build/netopeer-server-ml/Configure
(cd $(PKG_BUILD_DIR)/server ; $(call, Build/Configure/Default,))
endef
$(eval $(call BuildPackage,netopeer-server-ml))
Thank you once again for taking the time to read my post. I welcome any suggestions and comments on my predicament.