Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
985bdc3
Repology: Add initial metadata generation
Toasterson May 7, 2023
0f5ea36
Fixup repology make rules
Toasterson Sep 27, 2023
7f8bc90
Add more defintions to package defintions from Makefiles
Toasterson Sep 28, 2023
e4fc19b
Fix commands start with edit
Toasterson Sep 28, 2023
3698397
Fixup add dependency command
Toasterson Sep 28, 2023
4caca6b
Fix add dependency command
Toasterson Sep 28, 2023
efa4e09
Fix commands
Toasterson Sep 28, 2023
7ce520d
Add patches command
Toasterson Sep 28, 2023
be3db49
Add defining of build options and flags
Toasterson Sep 29, 2023
5a2d331
Fix if statement
Toasterson Sep 29, 2023
a9d8d8f
Better shell excaping
Toasterson Sep 29, 2023
9aacbc0
Updating for loop for better option capture
Toasterson Oct 3, 2023
c52ba12
Replace `repology.mk` with `forge.mk` for improved maintainability
Toasterson Sep 2, 2025
76b8b70
Remove backward compatibility for misspelled target in `forge.mk`
Toasterson Sep 2, 2025
012c09d
Ensure Cargo-installed tools are included in PATH in `forge.mk`
Toasterson Sep 2, 2025
3613639
Remove redundant flag in `add dependency` command
Toasterson Sep 2, 2025
60868a7
Remove redundant `--` flag in license command in `forge.mk`
Toasterson Sep 2, 2025
c520c9e
Remove redundant maintainer command in `forge.mk`
Toasterson Sep 2, 2025
8e04bce
Remove redundant maintainer command in `forge.mk`
Toasterson Sep 2, 2025
8996eec
Fix quoting for configure options in `forge.mk`
Toasterson Sep 2, 2025
b855721
Update `userland-gate.kdl` to 2025 branch and refine metadata transfo…
Toasterson Sep 2, 2025
a80fccf
Add `--gate` flag for configure builds in `forge.mk`
Toasterson Sep 2, 2025
4c1e2bd
Improve forge.mk error handling
Toasterson Oct 3, 2025
3bcbb54
Add Supporting targets to global makefiles
Toasterson Oct 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,37 @@ clobber: TARGET = clobber
setup: TARGET = setup
test: TARGET = test
component-hook: TARGET = component-hook
generate-package-kdl: TARGET = generate-package-kdl

.DEFAULT: publish

download setup prep build install pre-publish publish validate clean clobber \
test component-hook unpack patch: $(SUBDIRS)
download prep build install pre-publish publish validate clean clobber test component-hook generate-package-kdl unpack patch: $(SUBDIRS)

$(SUBDIRS): FORCE
@+echo "$(TARGET) $@" ; $(GMAKE) -s -C $@ $(TARGET)

FORCE:

# Bootstrap pkgdev before running component setup
setup: bootstrap-pkgdev $(SUBDIRS)

bootstrap-pkgdev:
@echo "Bootstrapping pkgdev via cargo from toasterson/forge"
cargo install --git https://github.com/toasterson/forge pkgdev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please publish forge at crates.io and then we should package it regularly. This cargo install looks like a nasty hack we should avoid.

Thank you.


update-pkgdev:
@echo "Updating pkgdev via cargo from toasterson/forge"
cargo install --git https://github.com/toasterson/forge pkgdev --force

# Generate repology metadata using pkgdev
.PHONY: repology
repology: bootstrap-pkgdev
@echo "Generating repology metadata with pkgdev"
pkgdev generate --output=repology-metadata.json repology

# Clean generated package.kdl files and missing-metadata list
.PHONY: clean-package-kdl
clean-package-kdl:
@echo "Cleaning generated package.kdl files and components.missing-metadata"
@/usr/bin/find components -type f -name package.kdl -exec rm -f {} +
@rm -f $(WS_TOP)/components.missing-metadata components.missing-metadata
3 changes: 3 additions & 0 deletions components/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ publish-branch:

download: TARGET = download
update-metadata: TARGET = update-metadata
generate-package-kdl: TARGET = generate-package-kdl
prep: TARGET = prep
build: TARGET = build
install: TARGET = install
Expand Down Expand Up @@ -102,6 +103,8 @@ download prep: $(COMPONENT_DIRS.nosetup)

update-metadata: $(COMPONENT_DIRS.nolog)

generate-package-kdl: $(COMPONENT_DIRS.nolog)

component-hook: $(COMPONENT_DIRS.nosetup)

clean: $(COMPONENT_DIRS.nosetup)
Expand Down
2 changes: 2 additions & 0 deletions make-rules/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,5 @@ COMPONENT_BUILD_CMAKE_ARGS += -j$(PARALLEL_JOBS)
COMPONENT_BUILD_GMAKE_ARGS += -j$(PARALLEL_JOBS)
COMPONENT_BUILD_SETUP_PY_ARGS += -j$(PARALLEL_JOBS)
endif

include $(WS_MAKE_RULES)/forge.mk
64 changes: 64 additions & 0 deletions make-rules/forge.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2023 Till Wegmueller
#

# Allow overriding via environment and default to relying on PATH
PKGDEV ?= pkgdev

# Ensure Cargo-installed tools (e.g., pkgdev) are on PATH
PATH := $(PATH):$(HOME)/.cargo/bin
export PATH

.PHONY: generate-package-kdl

# Generate package.kdl using pkgdev with component metadata
generate-package-kdl:
@compname="$(COMPONENT_NAME)"; \
[ -z "$$compname" ] && compname="$$(/usr/bin/basename "$$PWD")"; \
if [ -f "package.kdl" ]; then \
echo "Skipping package.kdl generation for $$compname: package.kdl already exists"; \
exit 0; \
fi; \
missing=""; \
[ -z "$(COMPONENT_NAME)" ] && missing="$$missing COMPONENT_NAME"; \
[ -z "$(COMPONENT_FMRI)" ] && missing="$$missing COMPONENT_FMRI"; \
[ -z "$(COMPONENT_SUMMARY)" ] && missing="$$missing COMPONENT_SUMMARY"; \
[ -z "$(COMPONENT_CLASSIFICATION)" ] && missing="$$missing COMPONENT_CLASSIFICATION"; \
[ -z "$(COMPONENT_LICENSE)" ] && missing="$$missing COMPONENT_LICENSE"; \
[ -z "$(COMPONENT_LICENSE_FILE)" ] && missing="$$missing COMPONENT_LICENSE_FILE"; \
[ -z "$(COMPONENT_VERSION)" ] && missing="$$missing COMPONENT_VERSION"; \
[ -z "$(COMPONENT_PROJECT_URL)" ] && missing="$$missing COMPONENT_PROJECT_URL"; \
[ -z "$(COMPONENT_ARCHIVE_URL)" ] && missing="$$missing COMPONENT_ARCHIVE_URL"; \
[ -z "$(COMPONENT_ARCHIVE_HASH)" ] && missing="$$missing COMPONENT_ARCHIVE_HASH"; \
if [ -n "$$missing" ]; then \
echo "Skipping package.kdl generation for $$compname: missing variables:$$missing"; \
if [ -n "$(WS_TOP)" ]; then echo "$$compname" >> "$(WS_TOP)/components.missing-metadata"; fi; \
exit 0; \
else \
echo "generating package.kdl for $$compname"; \
$(PKGDEV) create $(COMPONENT_FMRI); \
for package in $(REQUIRED_PACKAGES) ; do \
$(PKGDEV) edit add dependency --dev --kind require $$package ; \
done; \
$(PKGDEV) edit set project-name "$(COMPONENT_NAME)"; \
$(PKGDEV) edit set summary "$(COMPONENT_SUMMARY)"; \
$(PKGDEV) edit set classification "$(COMPONENT_CLASSIFICATION)"; \
$(PKGDEV) edit set license "$(COMPONENT_LICENSE)" -f "$(COMPONENT_LICENSE_FILE)"; \
$(PKGDEV) edit set version "$(COMPONENT_VERSION)"; \
$(PKGDEV) edit set project-url "$(COMPONENT_PROJECT_URL)"; \
$(PKGDEV) edit add source archive "$(COMPONENT_ARCHIVE_URL)" "$(COMPONENT_ARCHIVE_HASH)"; \
if [ -d "patches" ]; then $(PKGDEV) edit add source patch patches; fi; \
if [ "$(strip $(BUILD_STYLE))" = "configure" ]; then \
$(PKGDEV) edit add build --gate $(WS_TOP)/userland-gate.kdl configure $(foreach var,$(CONFIGURE_OPTIONS),"$(var)"); \
fi; \
fi
19 changes: 19 additions & 0 deletions userland-gate.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name "userland"
version "0.5.11"
branch "2025.0.0"
publisher "openindiana.org"

metadata-transform matcher="--libexecdir" replacement="--libexecdir=${LIBEXECDIR}"
metadata-transform matcher="--bindir" replacement="--bindir=${BINDIR}"
metadata-transform matcher="--sbindir" replacement="--sbindir=${SBINDIR}"
metadata-transform matcher="--mandir" replacement="--mandir=${MANDIR}"
metadata-transform matcher="--libdir" replacement="--libdir=${LIBDIR}"
metadata-transform matcher="--with-jobs" drop=true
metadata-transform matcher="CC" drop=true
metadata-transform matcher="CXX" drop=true
metadata-transform matcher="F77" drop=true
metadata-transform matcher="FC" drop=true
metadata-transform matcher="FFLAGS" drop=true
metadata-transform matcher="CFLAGS" drop=true
metadata-transform matcher="LDFLAGS" drop=true
metadata-transform matcher="PKG_CONFIG_PATH" drop=true