|
| 1 | +# |
| 2 | +# Copyright (C) 2019 gvalkov.com |
| 3 | +# |
| 4 | +# This is free software, licensed under the GNU General Public License v2. |
| 5 | +# See /LICENSE for more information. |
| 6 | +# https://wiki.openwrt.org/doc/devel/packages |
| 7 | +# |
| 8 | + |
| 9 | +include $(TOPDIR)/rules.mk |
| 10 | + |
| 11 | +PKG_NAME:=g_api |
| 12 | +PKG_BIN:=$(PKG_NAME).lib |
| 13 | +PKG_VERSION:=$(shell date +"%Y-%m-%d") |
| 14 | +PKG_RELEASE:=1 |
| 15 | + |
| 16 | +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz |
| 17 | +PKG_SOURCE_URL:=file://~/g |
| 18 | +PKG_HASH:=2c3daf2e61e4a01226c9e96392e76e5384afae9600d0416c0a6c6f04d378d1ef |
| 19 | + |
| 20 | +PKG_MAINTAINER:=Georgi Valkov <gvalkov@gmail.com> |
| 21 | +PKG_LICENSE:=GPL-2.0 |
| 22 | + |
| 23 | +ifeq (,$(findstring apple,$(shell $(COMPILE.cpp) --version))) |
| 24 | +# Linux |
| 25 | + USE_SOURCE_DIR:=~/g/lib/$(PKG_NAME) |
| 26 | +else |
| 27 | +# macOS |
| 28 | + USE_SOURCE_DIR:=~/Documents/vs-projects/lib/$(PKG_NAME) |
| 29 | +endif |
| 30 | + |
| 31 | +include $(INCLUDE_DIR)/package.mk |
| 32 | + |
| 33 | +define Package/$(PKG_NAME) |
| 34 | + SECTION:=libs |
| 35 | + CATEGORY:=Libraries |
| 36 | + TITLE:=g_api static library |
| 37 | + URL:=https://httpstorm.com/tools/lib/g_api/ |
| 38 | + DEPENDS:=+libgcrypt +libopenssl |
| 39 | +endef |
| 40 | + |
| 41 | +define Package/$(PKG_NAME)/description |
| 42 | + g_api static library |
| 43 | +endef |
| 44 | + |
| 45 | +define Build/Configure |
| 46 | +endef |
| 47 | + |
| 48 | +# -fno-exceptions: prevents undefined reference to _Unwind_Resume, __gxx_personality_v0 |
| 49 | +# test: -fno-rtti -fno-exceptions |
| 50 | +TARGET_CPPFLAGS:= \ |
| 51 | + $(TARGET_CPPFLAGS) -fno-exceptions \ |
| 52 | + -D_GNU_SOURCE -DEMBEDDED=1 -DOPENWRT=1 -D__OPENWRT__=1 |
| 53 | + |
| 54 | +# -nodefaultlibs: prevents missing dependencies on libstdc++.so.6 |
| 55 | +# -lc: prevents undefined reference to printf and many others, when -nodefaultlibs is used |
| 56 | +# test: -nodefaultlibs -lgcc -lc -uClibc++ -pthread |
| 57 | +MAKE_FLAGS += \ |
| 58 | + CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -ffunction-sections -fdata-sections" \ |
| 59 | + LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections -nodefaultlibs -lc" \ |
| 60 | + V=1 |
| 61 | + |
| 62 | +define Package/$(PKG_NAME)/install |
| 63 | + $(INSTALL_DIR) $(1)/usr/lib |
| 64 | + $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/$(PKG_BIN) $(1)/usr/lib/ |
| 65 | +endef |
| 66 | + |
| 67 | +$(eval $(call BuildPackage,$(PKG_NAME))) |
0 commit comments