#
# 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:=pcre2
PKG_VERSION:=10.31
PKG_RELEASE:=1

PKG_SOURCE_DIR:=$(BUILD_DIR)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/build
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@GNU/pcre2
PKG_MD5SUM:=10e1a95a0f0d80759f1b3d70e92c2cda

PKG_LICENSE:=BSD-3c
PKG_LICENSE_FILES:=LICENSE

PKG_FIXUP:=autoreconf
PKG_INSTALL:=1

include $(INCLUDE_DIR)/package.mk

define Package/libpcre2
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=Terminal handling libpcre2
  URL:=http://www.gnu.org/software/ncurses/
  DEPENDS:= 
  VARIANT:=libpcre2
endef

TARGET_CFLAGS += $(FPIC) -L$(STAGING_DIR)/usr/lib/ -I$(STAGING_DIR)/../host/include -L$(STAGING_DIR)/../host/lib

CONFIGURE_CMD:=../$(PKG_NAME)-$(PKG_VERSION)/configure

define Build/Prepare
	$(call Build/Prepare/Default,)
	$(INSTALL_DIR) $(PKG_BUILD_DIR)
endef

define Build/Compile
	$(MAKE) -C $(PKG_BUILD_DIR)
endef

define Package/libpcre2/install
	cp -rf $(PKG_INSTALL_DIR)/usr/* $(STAGING_DIR)/usr/
endef

$(eval $(call BuildPackage,libpcre2))
