packages/admin/btop/Makefile
Nick Hainke feaba4f52b btop: fix compilation with musl 1.2.4
_LARGEFILE64_SOURCE has to be defined in the source, or CFLAGS can be used
to pass -D_LARGEFILE64_SOURCE to allow to keep using LFS64 definitions.

Fixes errors in the form of:
Compiling src/linux/btop_collect.cpp
src/linux/btop_collect.cpp: In function 'Mem::mem_info& Mem::collect(bool)':
src/linux/btop_collect.cpp:1082:58: error: aggregate 'Mem::collect(bool)::statvfs64 vfs' has incomplete type and cannot be defined
 1082 |                                         struct statvfs64 vfs;
      |                                                          ^~~
src/linux/btop_collect.cpp:1083:79: error: invalid use of incomplete type 'struct Mem::collect(bool)::statvfs64'
 1083 |                                         if (statvfs64(mountpoint.c_str(), &vfs) < 0) {
      |                                                                               ^
src/linux/btop_collect.cpp:1082:48: note: forward declaration of 'struct Mem::collect(bool)::statvfs64'
 1082 |                                         struct statvfs64 vfs;
      |                                                ^~~~~~~~~
make[3]: *** [Makefile:274: obj/linux/btop_collect.o] Error 1
make[3]: Leaving directory '/home/nick/openwrt/build_dir/target-aarch64_cortex-a53_musl/btop-1.2.13'
make[2]: *** [Makefile:53: /home/nick/openwrt/build_dir/target-aarch64_cortex-a53_musl/btop-1.2.13/.built] Error 2
make[2]: Leaving directory '/home/nick/openwrt/feeds/packages/admin/btop'
time: package/feeds/packages/btop/compile#2.57#0.17#3.02
    ERROR: package/feeds/packages/btop failed to build.

Signed-off-by: Nick Hainke <vincent@systemli.org>
2023-05-17 07:46:11 +08:00

54 lines
1.3 KiB
Makefile

include $(TOPDIR)/rules.mk
PKG_NAME:=btop
PKG_VERSION:=1.2.13
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL=https://codeload.github.com/aristocratos/btop/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=668dc4782432564c35ad0d32748f972248cc5c5448c9009faeb3445282920e02
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/btop
SECTION:=admin
CATEGORY:=Administration
TITLE:=A monitor of resources
URL:=https://github.com/aristocratos/btop
DEPENDS:=+libstdcpp
endef
define Package/btop/description
Resource monitor that shows usage and stats for processor, memory,
disks, network and processes.
C++ version and continuation of bashtop and bpytop.
endef
MAKE_FLAGS+= \
PLATFORM=Linux \
OPTFLAGS="$(TARGET_CXXFLAGS)" \
LDCXXFLAGS="$(TARGET_LDFLAGS) -pthread"
ifneq ($(CONFIG_USE_MUSL),)
TARGET_CFLAGS += -D_LARGEFILE64_SOURCE
endif
define Package/btop/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/bin/btop $(1)/usr/bin/
$(INSTALL_DIR) $(1)/usr/share
$(CP) $(PKG_INSTALL_DIR)/usr/local/share/btop $(1)/usr/share/
$(INSTALL_DIR) $(1)/etc/profile.d
$(CP) $(CURDIR)/files/btop.sh $(1)/etc/profile.d/
endef
$(eval $(call BuildPackage,btop))