# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2025 IOPSYS Software Solutions AB

include $(TOPDIR)/rules.mk

PKG_NAME:=blkpg-part
PKG_VERSION:=1
PKG_RELEASE:=1
PKG_SOURCE_VERSION:=5a4ec5f53ed904b37fba03f3797fbe2af3077f8d
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/gportay/blkpg-part.git
PKG_MIRROR_HASH:=skip

PKG_MAINTAINER:=Andreas Gnau <andreas.gnau@iopsys.eu>
PKG_LICENSE:=LGPL-2.1-or-later
PKG_LICENSE_FILES:=LICENSE

PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1

include $(INCLUDE_DIR)/package.mk

MAKE_INSTALL_FLAGS += PREFIX=/usr

define Package/$(PKG_NAME)
  SECTION:=utils
  CATEGORY:=Utilities
  SUBMENU:=Disc
  TITLE:=User space partition table and disk geometry handling utility
  URL:=https://www.portay.io/blkpg-part/
endef

define Package/$(PKG_NAME)/description
  blkpg-part creates temporary partitions that are not part of the GPT/MBR.
  It makes a partition block device from any consecutive blocks that are
  not partitioned. It creates, resizes and deletes partitions on the fly
  without writing back the changes to the partition table.
endef

define Package/$(PKG_NAME)/install
	$(INSTALL_DIR) $(1)/usr/sbin
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/blkpg-part $(1)/usr/sbin/
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
