2022-09-06 23:57:09 -04:00
|
|
|
# targets.mk - hhl - /usr/include/mk
|
|
|
|
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
|
|
|
|
#
|
|
|
|
|
|
|
|
ifeq ($(no_objdir),1)
|
|
|
|
clean_cmd ?= $(MAKE) -C $(srcdir) clean distclean
|
|
|
|
else
|
|
|
|
clean_cmd ?= rm -rf $(objdir)
|
|
|
|
endif
|
|
|
|
|
|
|
|
distclean_cmd ?= rm -rf $(objdir) $(srcdir)
|
|
|
|
|
|
|
|
ifeq ($(distext),gz)
|
|
|
|
tarflags += -xzf
|
|
|
|
endif
|
|
|
|
ifeq ($(distext),bz2)
|
|
|
|
tarflags += -xjf
|
|
|
|
endif
|
|
|
|
ifeq ($(distext),xz)
|
|
|
|
tarflags += -xJf
|
|
|
|
endif
|
|
|
|
|
|
|
|
install_cmd ?= $(MAKE) DESTDIR=$(DESTDIR) -C $(objdir) install
|
|
|
|
|
|
|
|
all: $(all_deps)
|
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
|
|
|
|
install: $(workdir)/.installed
|
|
|
|
$(info $(grn)=== $(distfullname) installed ===$(reset))
|
|
|
|
|
|
|
|
.PHONY: install
|
|
|
|
|
|
|
|
package: $(pkglocal)
|
|
|
|
|
|
|
|
.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 \
|
|
|
|
$@
|
|
|
|
|
|
|
|
$(workdir)/.installed: $(pkglocal)
|
|
|
|
$(info $(grn)=== Installing $(distlocal) ===$(reset))
|
|
|
|
pkg_add $<
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(workdir)/.stripped: $(workdir)/.staged
|
|
|
|
find $(bindir) -type f -exec strip -s '{}' \; 2>&1 > /dev/null || true
|
|
|
|
find $(sbindir) -type f -exec strip -s '{}' \; 2>&1 > /dev/null || true
|
|
|
|
find $(libdir) -type f -exec strip -s '{}' \; 2>&1 > /dev/null || true
|
|
|
|
find $(libexecdir) -type f -exec strip -s '{}' \; 2>&1 > /dev/null || true
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(workdir)/.staged: $(workdir)/.built
|
|
|
|
$(info $(grn)=== $(distfullname) built ===$(reset))
|
|
|
|
$(info $(grn)=== Installing for $(distfullname) ===$(reset))
|
|
|
|
$(pre_install)
|
|
|
|
$(install_cmd)
|
|
|
|
$(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
|
2022-09-11 10:20:21 -04:00
|
|
|
@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
|
2022-09-06 23:57:09 -04:00
|
|
|
@for provides in $(pkg_provides) ; \
|
|
|
|
do echo PROVIDES=$${provides} >> work/build_info ; done
|
|
|
|
@mv work/build_info $@
|
|
|
|
|
|
|
|
$(installdirs):
|
|
|
|
install -d $@
|
|
|
|
|
|
|
|
$(workdir)/.built: $(build_deps) | $(pre_dirs)
|
|
|
|
$(info $(grn)=== Building for $(distfullname)$(reset))
|
|
|
|
$(pre_build)
|
|
|
|
$(build_cmd)
|
|
|
|
$(post_build)
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(config_tgt): $(config_deps) | $(pre_dirs)
|
|
|
|
$(info $(grn)=== Configuring for $(distfullname) ===$(reset))
|
|
|
|
$(pre_configure)
|
|
|
|
$(config_cmd)
|
|
|
|
$(post_configure)
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(srcdir)/.patched: $(patches) $(srcdir)/.dirstamp
|
|
|
|
$(info $(grn)=== Patching $(srcdir) ===$(reset))
|
|
|
|
for patch in $(patches) ; do cd $(srcdir) && \
|
2022-09-12 18:39:17 -04:00
|
|
|
patch -p1 < $(portdir)/$${patch} ; done
|
2022-09-06 23:57:09 -04:00
|
|
|
touch $@
|
|
|
|
|
2022-09-12 18:39:17 -04:00
|
|
|
$(srcdir)/.dirstamp: $(distlocal) $(workdir)/.dependencies_installed | $(workdir)
|
2022-09-06 23:57:09 -04:00
|
|
|
$(info $(grn)=== Extracting $(distlocal) ===$(reset))
|
|
|
|
[ "$$(sha512sum $(distlocal) | awk '{ print $$1 }')" == "$(sha512_sum)" ]
|
|
|
|
tar $(tarflags) $(distlocal) -C work/
|
|
|
|
touch $@
|
|
|
|
|
2022-09-11 10:20:21 -04:00
|
|
|
install_dependencies: $(workdir)/.dependencies_installed
|
|
|
|
|
|
|
|
.PHONY: install_dependencies
|
|
|
|
|
|
|
|
$(workdir)/.dependencies_installed: | $(workdir)
|
|
|
|
for dep in $(dependencies) ; \
|
2022-09-12 18:39:17 -04:00
|
|
|
do depname=$$(basename $${dep}) ; \
|
|
|
|
if [ $$(pkg_info -qe $${depname}) ] ; \
|
|
|
|
then make -C /usr/ports/$${dep} install; \
|
2022-09-11 10:20:21 -04:00
|
|
|
fi ; done
|
|
|
|
touch $@
|
|
|
|
|
2022-09-06 23:57:09 -04:00
|
|
|
ifeq ($(use_configure),1)
|
|
|
|
show-config_opts:
|
|
|
|
$(info $(grn)$(config_opts)$(reset))
|
|
|
|
else
|
|
|
|
show-config_opts:
|
|
|
|
$(info $(red)Package does not use configure$(reset))
|
|
|
|
endif
|
|
|
|
|
|
|
|
config.mk: config.mk.in
|
|
|
|
$(info $(grn)Creating config.mk with default options$(reset))
|
|
|
|
$(info If you wish to modify the defaults, press Control-C and edit config.mk and then restart the build)
|
|
|
|
cp config.mk.in config.mk
|
|
|
|
|
|
|
|
$(distlocal): | $(distdir)
|
|
|
|
$(info $(grn)=== Fetching $(distfile) ===$(reset))
|
|
|
|
wget -c $(dist_remote) -O $@
|
|
|
|
|
|
|
|
clean:
|
|
|
|
$(info $(grn)=== Cleaning for $(distname) ===$(reset))
|
|
|
|
rm -rf $(portdir)/work
|
|
|
|
|
|
|
|
.PHONY: clean
|