Some preparation to work with hpk instead of NetBSD pkgtools

This commit is contained in:
Nathan Fisher 2023-03-30 19:03:36 -04:00
parent 5e06435ce2
commit b24de13af5
3 changed files with 10 additions and 61 deletions

5
.gitignore vendored
View File

@ -1,6 +1,5 @@
config.mk
work
distfiles/*
packages/*.tgz
packages/*.tbz
packages/*.txz
packages/*.tar.zstd
tags

View File

@ -8,9 +8,9 @@ DESTDIR = $(workdir)/staged
basedir = $(portdir)/../..
include $(basedir)/config.mk
prefix ?= /usr/pkg
confdir ?= $(prefix)/etc
localstatedir ?= $(prefix)/var
prefix ?= /usr
confdir ?= /etc
localstatedir ?= /var
logdir ?= $(localstatedir)/log
default_goal ?= all
install_cmd ?= $(MAKE) $(makeflags) DESTDIR=$(DESTDIR) -C $(objdir) install
@ -42,11 +42,11 @@ man8dir = $(mandir)/man8
distname ?= $(pkg_name)
pkg_rev ?= 1
pkg_ext ?= tgz
pkgfullname ?= $(pkg_name)-$(pkg_version)_hhl$(pkg_rev)
pkg_ext ?= tar.zstd
pkgfullname ?= $(pkg_name)-$(pkg_version)_$(pkg_rev)
pkgfile ?= $(pkgfullname).$(pkg_ext)
pkglocal ?= $(pkgdir)/$(pkgfile)
pkgdeps = $(workdir)/.stripped $(workdir)/PLIST $(workdir)/BUILD_INFO
pkgdeps = $(workdir)/.stripped package.specs
distdir = $(basedir)/distfiles
distfullname ?= $(distname)-$(pkg_version)
distext ?= xz

View File

@ -32,22 +32,13 @@ install: $(workdir)/.installed
.PHONY: install
package: $(pkglocal)
$(info $(grn)=== $(pkgfullname) created ===$(reset))
.PHONY: package
$(info $(grn)=== $(pkgfullname) created ===$(reset))
$(pkglocal): $(pkgdeps) | $(pkgdir)
$(info $(grn)=== creating package $(pkgfullname) ===$(reset))
pkg_create \
-c -"$(comment)" \
-B $(workdir)/BUILD_INFO \
-d $(portdir)/DESCR \
-f $(workdir)/PLIST \
-I / \
-p $(DESTDIR) \
-g root \
-u root \
$@
hpk create -o $(pkgdir) -s package.specs $(DESTDIR)
$(workdir)/.installed: $(pkglocal)
$(info $(grn)=== Installing $(distlocal) ===$(reset))
@ -69,47 +60,6 @@ $(workdir)/.staged: $(workdir)/.built
$(post_install)
touch $@
$(workdir)/PLIST: $(workdir)/.staged
cd $(DESTDIR) && \
find usr -type f -o -type l | sort -u > $@
$(workdir)/BUILD_INFO: $(workdir)/.staged
@echo ABI=$(ABI) > work/build_info
@echo BUILD_DATE=$$(date -u "+%y-%m-%d %H:%M:%S") +0000 >> work/build_info
@echo BUILD_HOST=$$(uname -a) >> work/build_info
@echo CATEGORIES=$$(basename $$(dirname $(portdir))) >> work/build_info
@echo CC_VERSION=gcc-$$(gcc --version | head -n 1 | awk '{print $$3}') \
>> work/build_info
@echo CFLAGS=$(CFLAGS) >> work/build_info
@echo GLIBC_VERSION=$$(/lib/libc.so.6 | head -n 1 | awk '{print $9}' | \
cut -b 1-4) >> work/build_info
@echo HOMEPAGE=$(pkg_homepage) >> work/build_info
@echo LDFLAGS=$(LDFLAGS) >> work/build_info
@echo LICENSE=$(pkg_license) >> work/build_info
@echo LOCALBASE=/usr/pkg >> work/build_info
@echo MACHINE_ARCH=$$(uname -m) >> work/build_info
@echo MAINTAINER=$(pkg_maintainer) >> work/build_info
@echo OBJECT_FMT=ELF >> work/build_info
@echo OPSYS=Linux >> work/build_info
@echo OS_VERSION=$$(uname -r) >> work/build_info
@echo PKGGNUDIR=gnu >> work/build_info
@echo PKGINFODIR=info >> work/build_info
@echo PKGMANDIR=man >> work/build_info
@echo PKGPATH=$$(basename $$(dirname $(portdir)))/$$(basename $(portdir)) \
>> work/build_info
@echo PKGSYSCONFBASEDIR=/usr/pkg/etc >> work/build_info
@echo PKGSYSCONFDIR=/usr/pkg/etc >> work/build_info
@echo PKGTOOLS_VERSION=$$(pkg_add -V) >> work/build_info
@find $(DESTDIR) -type f | while read f ; \
do if [ "$$(file $$f | grep ELF)" != "" ] ; \
then ldd $$f ; fi ; \
done | awk '{ print $$3 }' | grep -v linux-vdso | sort -u | \
while read f ; \
do echo REQUIRES=$$f >> work/build_info ; done
@for provides in $(pkg_provides) ; \
do echo PROVIDES=$${provides} >> work/build_info ; done
@mv work/build_info $@
$(installdirs):
install -d $@