blob: 79b0f810281ffaac67c4d939a80cb8a5b068eeee [file] [log] [blame]
#
# Copyright (C) 2010-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
define Package/agpstp/config
source "$(SOURCE)/Config.in"
endef
ifeq ($(CONFIG_USE_GLIBC),y)
toolchain:=-glibc
endif
PKG_NAME:=agpstp
PKG_VERSION:=2024-11-08
PKG_REV_LONG:=f1b1863caff7e284ed7b7d97d74fb84076929b59
GCC_MAJOR := $(shell echo $(CONFIG_GCC_VERSION) | cut -d. -f1)
ifneq ($(GCC_MAJOR),)
ifeq ($(shell [ $(GCC_MAJOR) -gt 12 ] && echo 1 || echo 0), 1)
$(info GCC_MAJOR is greater than 12)
gccversion:=-gcc$(GCC_MAJOR)
else
$(info GCC_MAJOR is not greater than 12)
endif
endif
PKG_REV:=$(shell echo $(PKG_REV_LONG) | cut -c1-7)
PKG_TAG:=$(PKG_NAME)-v21$(gccversion)$(toolchain)-v$(PKG_VERSION)-r$(PKG_REV)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_TAG)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=ssh://$(USER)@source.asrmicro.com:29418/asr/lbs/agpstp -b master
PKG_SOURCE_SUBDIR:=$(PKG_TAG)
PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_SOURCE:=$(PKG_TAG).tar.gz
PREBUILT_FNAME:=prebuilt-$(PKG_TAG)
PREBUILT_FPATH:=$(CURDIR)/prebuilt/$(PREBUILT_FNAME).tar.gz
ifeq ($(CONFIG_AGPSTP_LOCAL_CODE),y)
USE_SOURCE_DIR:=$(MRVLDIR)/agpstp
endif
PKG_INSTALL:=1
PKG_MAINTAINER:=Hui Zhang <huizhang@asrmicro.com>
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/agpstp
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libpthread +liblog
TITLE:=ASR AGPSTP Library
endef
define Package/agpstp/description
ASR AGPSTP Library support
endef
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_TAG)
ifneq ($(CONFIG_AGPSTP_PREBUILT),)
define Download
endef
define Build/Prepare
$(if $(wildcard $(PREBUILT_FPATH)),,@echo "Error: $(PREBUILT_FPATH) not found"; false)
endef
define Build/Configure
endef
define Build/Compile
endef
define Build/Install
$(INSTALL_DIR) $(PKG_INSTALL_DIR)
echo "Unpacking prebuilt..." && \
$(TAR) -zxvf $(PREBUILT_FPATH) -C $(TMP_DIR) && \
$(CP) $(TMP_DIR)/$(PREBUILT_FNAME)/* $(PKG_INSTALL_DIR) && \
rm -rf $(TMP_DIR)/$(PREBUILT_FNAME);
endef
else
ifeq ($(CONFIG_AGPSTP_LOCAL_CODE),y)
define Package/agpstp/Prepare
rm -rf $(PKG_BUILD_DIR)
ln -s $(USE_SOURCE_DIR) $(PKG_BUILD_DIR)
endef
endif
endif
define Prebuilt/Pack
echo "Packing prebuilt..." && \
mkdir -p $(TMP_DIR)/$(PREBUILT_FNAME) && \
cd $(TMP_DIR) && \
$(CP) $(PKG_INSTALL_DIR)/* ./$(PREBUILT_FNAME) && \
$(TAR) czf $(PREBUILT_FNAME).tar.gz $(PREBUILT_FNAME) && \
mv $(TMP_DIR)/$(PREBUILT_FNAME).tar.gz $(PREBUILT_FPATH) && \
rm -rf $(TMP_DIR)/$(PREBUILT_FNAME);
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/lib $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include
endef
define Package/agpstp/install
$(INSTALL_DIR) $(1)/usr/lib $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include
$(if $(wildcard $(PREBUILT_FPATH)),$(if $(CONFIG_AGPSTP_PREBUILT_OVERRIDE),@echo "WARNING: prebuilt override!"; $(call Prebuilt/Pack)),$(call Prebuilt/Pack))
endef
$(eval $(call BuildPackage,agpstp))