From 08dbee6bba6c9dd46f960c2da4418ec43f44846e Mon Sep 17 00:00:00 2001 From: Till Wegmueller Date: Mon, 28 Mar 2022 15:05:56 -0300 Subject: [PATCH] Add oi-userland as sample data --- .idea/git_toolbox_prj.xml | 15 + .../developer}/golang-116/Makefile | 52 +- .../developer}/golang-116/golang-116.p5m | 0 .../developer}/golang-116/golang.license | 0 .../developer}/golang-116/golang.p5m | 0 .../golang-116/manifests/sample-manifest.p5m | 0 .../patches/01-golang-gdb-python-test.patch | 0 .../golang-116/patches/02_Dup2_golang10.patch | 0 .../0602-update-list-of-syscall-numbers.patch | 0 .../developer}/golang-116/pkg5 | 0 .../{pkgs => components/print}/cups/Makefile | 0 .../print}/cups/Solaris/ManageCUPS.html | 0 .../print}/cups/Solaris/auth_attr | 0 .../cups/Solaris/desktop-print-management | 0 .../Solaris/desktop-print-management-applet | 0 .../cups/Solaris/print-service-selector | 0 .../print}/cups/Solaris/prof_attr | 0 .../print}/cups/Solaris/service-selector.xml | 0 .../print}/cups/Solaris/smb | 0 .../print}/cups/Solaris/svc-cupsd | 0 .../print}/cups/Solaris/tsol_banner.ps | 0 .../print}/cups/Solaris/tsol_separator.ps | 0 .../print}/cups/Solaris/tsol_trailer.ps | 0 .../print}/cups/cups-libs.p5m | 0 .../print}/cups/cups-license | 0 .../{pkgs => components/print}/cups/cups.p5m | 0 .../print}/cups/manifests/sample-manifest.p5m | 0 .../print}/cups/patches/02-smf.patch | 0 .../cups/patches/properly-check-pie.patch | 0 .../{pkgs => components/print}/cups/pkg5 | 0 sample_data/make-rules/ant.mk | 88 + sample_data/make-rules/attpackagemake.mk | 126 ++ sample_data/make-rules/cmake.mk | 232 +++ sample_data/make-rules/common-lisp.mk | 46 + sample_data/make-rules/common.mk | 191 +++ sample_data/make-rules/component-report | 56 + sample_data/make-rules/component.mk | 33 + sample_data/make-rules/configure.mk | 249 +++ sample_data/make-rules/depend.mk | 25 + sample_data/make-rules/encumbered.mk | 24 + sample_data/make-rules/environment.mk | 119 ++ sample_data/make-rules/font.mk | 201 +++ sample_data/make-rules/gcc-component.mk | 208 +++ sample_data/make-rules/gem.mk | 107 ++ sample_data/make-rules/history.mk | 110 ++ sample_data/make-rules/install.rb.mk | 50 + sample_data/make-rules/ips-buildinfo.mk | 71 + sample_data/make-rules/ips.mk | 627 +++++++ sample_data/make-rules/justmake.mk | 116 ++ sample_data/make-rules/makemaker.mk | 173 ++ sample_data/make-rules/mate.mk | 60 + sample_data/make-rules/meson.mk | 166 ++ sample_data/make-rules/modules.mk | 29 + sample_data/make-rules/mpi-macros.mk | 156 ++ sample_data/make-rules/ninja.mk | 119 ++ sample_data/make-rules/ocaml.mk | 19 + sample_data/make-rules/prep-download.mk | 84 + sample_data/make-rules/prep-git.mk | 127 ++ sample_data/make-rules/prep-hg.mk | 97 ++ sample_data/make-rules/prep-patch.mk | 111 ++ sample_data/make-rules/prep-svn.mk | 84 + sample_data/make-rules/prep-unpack.mk | 76 + sample_data/make-rules/prep.mk | 51 + sample_data/make-rules/ruby.mk | 43 + sample_data/make-rules/setup.py.mk | 185 +++ sample_data/make-rules/shared-macros.mk | 1435 +++++++++++++++++ sample_data/make-rules/shared-targets.mk | 81 + sample_data/make-rules/waf.mk | 246 +++ sample_data/make-rules/x11.mk | 145 ++ 69 files changed, 6207 insertions(+), 26 deletions(-) create mode 100644 .idea/git_toolbox_prj.xml rename sample_data/{pkgs => components/developer}/golang-116/Makefile (75%) rename sample_data/{pkgs => components/developer}/golang-116/golang-116.p5m (100%) rename sample_data/{pkgs => components/developer}/golang-116/golang.license (100%) rename sample_data/{pkgs => components/developer}/golang-116/golang.p5m (100%) rename sample_data/{pkgs => components/developer}/golang-116/manifests/sample-manifest.p5m (100%) rename sample_data/{pkgs => components/developer}/golang-116/patches/01-golang-gdb-python-test.patch (100%) rename sample_data/{pkgs => components/developer}/golang-116/patches/02_Dup2_golang10.patch (100%) rename sample_data/{pkgs => components/developer}/golang-116/patches/0602-update-list-of-syscall-numbers.patch (100%) rename sample_data/{pkgs => components/developer}/golang-116/pkg5 (100%) rename sample_data/{pkgs => components/print}/cups/Makefile (100%) rename sample_data/{pkgs => components/print}/cups/Solaris/ManageCUPS.html (100%) rename sample_data/{pkgs => components/print}/cups/Solaris/auth_attr (100%) rename sample_data/{pkgs => components/print}/cups/Solaris/desktop-print-management (100%) rename sample_data/{pkgs => components/print}/cups/Solaris/desktop-print-management-applet (100%) rename sample_data/{pkgs => components/print}/cups/Solaris/print-service-selector (100%) rename sample_data/{pkgs => components/print}/cups/Solaris/prof_attr (100%) rename sample_data/{pkgs => components/print}/cups/Solaris/service-selector.xml (100%) rename sample_data/{pkgs => components/print}/cups/Solaris/smb (100%) rename sample_data/{pkgs => components/print}/cups/Solaris/svc-cupsd (100%) rename sample_data/{pkgs => components/print}/cups/Solaris/tsol_banner.ps (100%) rename sample_data/{pkgs => components/print}/cups/Solaris/tsol_separator.ps (100%) rename sample_data/{pkgs => components/print}/cups/Solaris/tsol_trailer.ps (100%) rename sample_data/{pkgs => components/print}/cups/cups-libs.p5m (100%) rename sample_data/{pkgs => components/print}/cups/cups-license (100%) rename sample_data/{pkgs => components/print}/cups/cups.p5m (100%) rename sample_data/{pkgs => components/print}/cups/manifests/sample-manifest.p5m (100%) rename sample_data/{pkgs => components/print}/cups/patches/02-smf.patch (100%) rename sample_data/{pkgs => components/print}/cups/patches/properly-check-pie.patch (100%) rename sample_data/{pkgs => components/print}/cups/pkg5 (100%) create mode 100644 sample_data/make-rules/ant.mk create mode 100644 sample_data/make-rules/attpackagemake.mk create mode 100644 sample_data/make-rules/cmake.mk create mode 100644 sample_data/make-rules/common-lisp.mk create mode 100644 sample_data/make-rules/common.mk create mode 100644 sample_data/make-rules/component-report create mode 100644 sample_data/make-rules/component.mk create mode 100644 sample_data/make-rules/configure.mk create mode 100644 sample_data/make-rules/depend.mk create mode 100644 sample_data/make-rules/encumbered.mk create mode 100644 sample_data/make-rules/environment.mk create mode 100644 sample_data/make-rules/font.mk create mode 100644 sample_data/make-rules/gcc-component.mk create mode 100644 sample_data/make-rules/gem.mk create mode 100644 sample_data/make-rules/history.mk create mode 100644 sample_data/make-rules/install.rb.mk create mode 100644 sample_data/make-rules/ips-buildinfo.mk create mode 100644 sample_data/make-rules/ips.mk create mode 100644 sample_data/make-rules/justmake.mk create mode 100644 sample_data/make-rules/makemaker.mk create mode 100644 sample_data/make-rules/mate.mk create mode 100644 sample_data/make-rules/meson.mk create mode 100644 sample_data/make-rules/modules.mk create mode 100644 sample_data/make-rules/mpi-macros.mk create mode 100644 sample_data/make-rules/ninja.mk create mode 100644 sample_data/make-rules/ocaml.mk create mode 100644 sample_data/make-rules/prep-download.mk create mode 100644 sample_data/make-rules/prep-git.mk create mode 100644 sample_data/make-rules/prep-hg.mk create mode 100644 sample_data/make-rules/prep-patch.mk create mode 100644 sample_data/make-rules/prep-svn.mk create mode 100644 sample_data/make-rules/prep-unpack.mk create mode 100644 sample_data/make-rules/prep.mk create mode 100644 sample_data/make-rules/ruby.mk create mode 100644 sample_data/make-rules/setup.py.mk create mode 100644 sample_data/make-rules/shared-macros.mk create mode 100644 sample_data/make-rules/shared-targets.mk create mode 100644 sample_data/make-rules/waf.mk create mode 100644 sample_data/make-rules/x11.mk diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml new file mode 100644 index 0000000..02b915b --- /dev/null +++ b/.idea/git_toolbox_prj.xml @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/sample_data/pkgs/golang-116/Makefile b/sample_data/components/developer/golang-116/Makefile similarity index 75% rename from sample_data/pkgs/golang-116/Makefile rename to sample_data/components/developer/golang-116/Makefile index 24d6dcd..25d357b 100644 --- a/sample_data/pkgs/golang-116/Makefile +++ b/sample_data/components/developer/golang-116/Makefile @@ -57,8 +57,8 @@ COMPONENT_BUILD_ENV += GOEXPERIMENT="$(GOEXPERIMENT)" COMPONENT_BUILD_ENV += GOOS="illumos" COMPONENT_BUILD_ENV += GOCACHE="$(SOURCE_DIR)/gocache" COMPONENT_BUILD_ENV += GOPATH="$(SOURCE_DIR)/gopath" -# COMPONENT_BUILD_ENV += \ -# GOROOT_BOOTSTRAP="/usr/lib/golang/$(COMPONENT_MAJOR_VERSION)" +COMPONENT_BUILD_ENV += \ + GOROOT_BOOTSTRAP="/usr/lib/golang/$(COMPONENT_MAJOR_VERSION)" # For convenience during installation of supplementary packages. COMPONENT_INSTALL_ENV += PATH="$(PROTO_DIR)$(GOROOT_FINAL)/bin:$(PATH)" @@ -74,16 +74,16 @@ include $(WS_MAKE_RULES)/common.mk # We have to fiddle with the package archives to get them into the same source # directory so that we can use the standard build targets. We're effectively # building multiple components using a single target. -# COMPONENT_POST_UNPACK_ACTION= \ -# $(MV) go $(COMPONENT_SRC) +COMPONENT_POST_UNPACK_ACTION= \ + $(MV) go $(COMPONENT_SRC) # Go doesn't have a standard Makefile-based build process, so override the # default. -# COMPONENT_BUILD_ACTION= \ -# cd $(@D)/src; $(ENV) $(COMPONENT_BUILD_ENV) ./make.bash +COMPONENT_BUILD_ACTION= \ + cd $(@D)/src; $(ENV) $(COMPONENT_BUILD_ENV) ./make.bash -# COMPONENT_TARGET_DIR= \ -# $(PROTOUSRLIBDIR)/$(COMPONENT_NAME)/$(COMPONENT_MAJOR_VERSION) +COMPONENT_TARGET_DIR= \ + $(PROTOUSRLIBDIR)/$(COMPONENT_NAME)/$(COMPONENT_MAJOR_VERSION) # We can't do any ASLR'ing as the Go 6l linker has no understanding of the # -z aslr=... option. So just override where needed in the .p5m files. @@ -97,24 +97,24 @@ COMPONENT_TEST_TARGETS= # Use this Command to copy the Go Source tree into the proto area. In order to deliver the Go SDK under GOROOT # Additionally nuke all the funky binary files used for test suites. They keep bothering the packaging tools -#define COMPONENT_INSTALL_ACTION= -# ($(MKDIR) $(COMPONENT_TARGET_DIR)/src); \ -# (cd $(SOURCE_DIR) && \ -# /usr/gnu/bin/find . -maxdepth 1 -path "./$(COMPONENT_SRC_NAME)" \ -# -prune -o \( ! -iname ".*" \) -print \ -# -exec /usr/gnu/bin/cp -r \ -# --parents {} $(COMPONENT_TARGET_DIR) \;); \ -# (cd $(BUILD_DIR_64) && \ -# /usr/gnu/bin/find src -type f \ -# -exec /usr/gnu/bin/cp --parents {} $(COMPONENT_TARGET_DIR) \;); \ -# (cd $(BUILD_DIR_64) && $(CP) -r bin $(COMPONENT_TARGET_DIR)/); \ -# (cd $(BUILD_DIR_64) && $(CP) -r pkg $(COMPONENT_TARGET_DIR)/); \ -# (rm -r $(COMPONENT_TARGET_DIR)/pkg/obj); \ -# ($(MKDIR) -p $(MEDIATEDUSRSHAREMAN1DIR)); \ -# /usr/gnu/bin/find $(COMPONENT_TARGET_DIR)/src -type f \ -# | egrep -v '\.go|\.s|\.bash|\.txt|\.c|\.tmpl|\.h|\.pl|\.md|\.S|\.py|\.dist|\.rc|\.bat|README|Makefile|\.awk|\.rules|\.mod|\.json|LICENSE|PATENTS'\ -# | xargs rm; -#endef +define COMPONENT_INSTALL_ACTION= + ($(MKDIR) $(COMPONENT_TARGET_DIR)/src); \ + (cd $(SOURCE_DIR) && \ + /usr/gnu/bin/find . -maxdepth 1 -path "./$(COMPONENT_SRC_NAME)" \ + -prune -o \( ! -iname ".*" \) -print \ + -exec /usr/gnu/bin/cp -r \ + --parents {} $(COMPONENT_TARGET_DIR) \;); \ + (cd $(BUILD_DIR_64) && \ + /usr/gnu/bin/find src -type f \ + -exec /usr/gnu/bin/cp --parents {} $(COMPONENT_TARGET_DIR) \;); \ + (cd $(BUILD_DIR_64) && $(CP) -r bin $(COMPONENT_TARGET_DIR)/); \ + (cd $(BUILD_DIR_64) && $(CP) -r pkg $(COMPONENT_TARGET_DIR)/); \ + (rm -r $(COMPONENT_TARGET_DIR)/pkg/obj); \ + ($(MKDIR) -p $(MEDIATEDUSRSHAREMAN1DIR)); \ + /usr/gnu/bin/find $(COMPONENT_TARGET_DIR)/src -type f \ + | egrep -v '\.go|\.s|\.bash|\.txt|\.c|\.tmpl|\.h|\.pl|\.md|\.S|\.py|\.dist|\.rc|\.bat|README|Makefile|\.awk|\.rules|\.mod|\.json|LICENSE|PATENTS'\ + | xargs rm; +endef REQUIRED_PACKAGES += developer/golang-115 # Auto-generated dependencies diff --git a/sample_data/pkgs/golang-116/golang-116.p5m b/sample_data/components/developer/golang-116/golang-116.p5m similarity index 100% rename from sample_data/pkgs/golang-116/golang-116.p5m rename to sample_data/components/developer/golang-116/golang-116.p5m diff --git a/sample_data/pkgs/golang-116/golang.license b/sample_data/components/developer/golang-116/golang.license similarity index 100% rename from sample_data/pkgs/golang-116/golang.license rename to sample_data/components/developer/golang-116/golang.license diff --git a/sample_data/pkgs/golang-116/golang.p5m b/sample_data/components/developer/golang-116/golang.p5m similarity index 100% rename from sample_data/pkgs/golang-116/golang.p5m rename to sample_data/components/developer/golang-116/golang.p5m diff --git a/sample_data/pkgs/golang-116/manifests/sample-manifest.p5m b/sample_data/components/developer/golang-116/manifests/sample-manifest.p5m similarity index 100% rename from sample_data/pkgs/golang-116/manifests/sample-manifest.p5m rename to sample_data/components/developer/golang-116/manifests/sample-manifest.p5m diff --git a/sample_data/pkgs/golang-116/patches/01-golang-gdb-python-test.patch b/sample_data/components/developer/golang-116/patches/01-golang-gdb-python-test.patch similarity index 100% rename from sample_data/pkgs/golang-116/patches/01-golang-gdb-python-test.patch rename to sample_data/components/developer/golang-116/patches/01-golang-gdb-python-test.patch diff --git a/sample_data/pkgs/golang-116/patches/02_Dup2_golang10.patch b/sample_data/components/developer/golang-116/patches/02_Dup2_golang10.patch similarity index 100% rename from sample_data/pkgs/golang-116/patches/02_Dup2_golang10.patch rename to sample_data/components/developer/golang-116/patches/02_Dup2_golang10.patch diff --git a/sample_data/pkgs/golang-116/patches/0602-update-list-of-syscall-numbers.patch b/sample_data/components/developer/golang-116/patches/0602-update-list-of-syscall-numbers.patch similarity index 100% rename from sample_data/pkgs/golang-116/patches/0602-update-list-of-syscall-numbers.patch rename to sample_data/components/developer/golang-116/patches/0602-update-list-of-syscall-numbers.patch diff --git a/sample_data/pkgs/golang-116/pkg5 b/sample_data/components/developer/golang-116/pkg5 similarity index 100% rename from sample_data/pkgs/golang-116/pkg5 rename to sample_data/components/developer/golang-116/pkg5 diff --git a/sample_data/pkgs/cups/Makefile b/sample_data/components/print/cups/Makefile similarity index 100% rename from sample_data/pkgs/cups/Makefile rename to sample_data/components/print/cups/Makefile diff --git a/sample_data/pkgs/cups/Solaris/ManageCUPS.html b/sample_data/components/print/cups/Solaris/ManageCUPS.html similarity index 100% rename from sample_data/pkgs/cups/Solaris/ManageCUPS.html rename to sample_data/components/print/cups/Solaris/ManageCUPS.html diff --git a/sample_data/pkgs/cups/Solaris/auth_attr b/sample_data/components/print/cups/Solaris/auth_attr similarity index 100% rename from sample_data/pkgs/cups/Solaris/auth_attr rename to sample_data/components/print/cups/Solaris/auth_attr diff --git a/sample_data/pkgs/cups/Solaris/desktop-print-management b/sample_data/components/print/cups/Solaris/desktop-print-management similarity index 100% rename from sample_data/pkgs/cups/Solaris/desktop-print-management rename to sample_data/components/print/cups/Solaris/desktop-print-management diff --git a/sample_data/pkgs/cups/Solaris/desktop-print-management-applet b/sample_data/components/print/cups/Solaris/desktop-print-management-applet similarity index 100% rename from sample_data/pkgs/cups/Solaris/desktop-print-management-applet rename to sample_data/components/print/cups/Solaris/desktop-print-management-applet diff --git a/sample_data/pkgs/cups/Solaris/print-service-selector b/sample_data/components/print/cups/Solaris/print-service-selector similarity index 100% rename from sample_data/pkgs/cups/Solaris/print-service-selector rename to sample_data/components/print/cups/Solaris/print-service-selector diff --git a/sample_data/pkgs/cups/Solaris/prof_attr b/sample_data/components/print/cups/Solaris/prof_attr similarity index 100% rename from sample_data/pkgs/cups/Solaris/prof_attr rename to sample_data/components/print/cups/Solaris/prof_attr diff --git a/sample_data/pkgs/cups/Solaris/service-selector.xml b/sample_data/components/print/cups/Solaris/service-selector.xml similarity index 100% rename from sample_data/pkgs/cups/Solaris/service-selector.xml rename to sample_data/components/print/cups/Solaris/service-selector.xml diff --git a/sample_data/pkgs/cups/Solaris/smb b/sample_data/components/print/cups/Solaris/smb similarity index 100% rename from sample_data/pkgs/cups/Solaris/smb rename to sample_data/components/print/cups/Solaris/smb diff --git a/sample_data/pkgs/cups/Solaris/svc-cupsd b/sample_data/components/print/cups/Solaris/svc-cupsd similarity index 100% rename from sample_data/pkgs/cups/Solaris/svc-cupsd rename to sample_data/components/print/cups/Solaris/svc-cupsd diff --git a/sample_data/pkgs/cups/Solaris/tsol_banner.ps b/sample_data/components/print/cups/Solaris/tsol_banner.ps similarity index 100% rename from sample_data/pkgs/cups/Solaris/tsol_banner.ps rename to sample_data/components/print/cups/Solaris/tsol_banner.ps diff --git a/sample_data/pkgs/cups/Solaris/tsol_separator.ps b/sample_data/components/print/cups/Solaris/tsol_separator.ps similarity index 100% rename from sample_data/pkgs/cups/Solaris/tsol_separator.ps rename to sample_data/components/print/cups/Solaris/tsol_separator.ps diff --git a/sample_data/pkgs/cups/Solaris/tsol_trailer.ps b/sample_data/components/print/cups/Solaris/tsol_trailer.ps similarity index 100% rename from sample_data/pkgs/cups/Solaris/tsol_trailer.ps rename to sample_data/components/print/cups/Solaris/tsol_trailer.ps diff --git a/sample_data/pkgs/cups/cups-libs.p5m b/sample_data/components/print/cups/cups-libs.p5m similarity index 100% rename from sample_data/pkgs/cups/cups-libs.p5m rename to sample_data/components/print/cups/cups-libs.p5m diff --git a/sample_data/pkgs/cups/cups-license b/sample_data/components/print/cups/cups-license similarity index 100% rename from sample_data/pkgs/cups/cups-license rename to sample_data/components/print/cups/cups-license diff --git a/sample_data/pkgs/cups/cups.p5m b/sample_data/components/print/cups/cups.p5m similarity index 100% rename from sample_data/pkgs/cups/cups.p5m rename to sample_data/components/print/cups/cups.p5m diff --git a/sample_data/pkgs/cups/manifests/sample-manifest.p5m b/sample_data/components/print/cups/manifests/sample-manifest.p5m similarity index 100% rename from sample_data/pkgs/cups/manifests/sample-manifest.p5m rename to sample_data/components/print/cups/manifests/sample-manifest.p5m diff --git a/sample_data/pkgs/cups/patches/02-smf.patch b/sample_data/components/print/cups/patches/02-smf.patch similarity index 100% rename from sample_data/pkgs/cups/patches/02-smf.patch rename to sample_data/components/print/cups/patches/02-smf.patch diff --git a/sample_data/pkgs/cups/patches/properly-check-pie.patch b/sample_data/components/print/cups/patches/properly-check-pie.patch similarity index 100% rename from sample_data/pkgs/cups/patches/properly-check-pie.patch rename to sample_data/components/print/cups/patches/properly-check-pie.patch diff --git a/sample_data/pkgs/cups/pkg5 b/sample_data/components/print/cups/pkg5 similarity index 100% rename from sample_data/pkgs/cups/pkg5 rename to sample_data/components/print/cups/pkg5 diff --git a/sample_data/make-rules/ant.mk b/sample_data/make-rules/ant.mk new file mode 100644 index 0000000..4d45e5f --- /dev/null +++ b/sample_data/make-rules/ant.mk @@ -0,0 +1,88 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# + +ANT=/usr/bin/ant + +COMPONENT_BUILD_ENV += JAVA_HOME="$(JAVA_HOME)" +# build the configured source +$(BUILD_DIR)/%/.built: $(SOURCE_DIR)/.prep + $(RM) -r $(@D) ; $(MKDIR) $(@D) + $(CLONEY) $(SOURCE_DIR) $(@D) + $(COMPONENT_PRE_BUILD_ACTION) + (cd $(@D) ; $(ENV) $(COMPONENT_BUILD_ENV) \ + $(ANT) $(COMPONENT_BUILD_ARGS) $(COMPONENT_BUILD_TARGETS)) + $(COMPONENT_POST_BUILD_ACTION) +ifeq ($(strip $(PARFAIT_BUILD)),yes) + -$(PARFAIT) $(@D) +endif + $(TOUCH) $@ + +COMPONENT_INSTALL_ENV += JAVA_HOME="$(JAVA_HOME)" +# install the built source into a prototype area +$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built + $(COMPONENT_PRE_INSTALL_ACTION) + (cd $(@D) ; $(ENV) $(COMPONENT_INSTALL_ENV) \ + $(ANT) $(COMPONENT_INSTALL_ARGS) $(COMPONENT_INSTALL_TARGETS)) + $(COMPONENT_POST_INSTALL_ACTION) + $(TOUCH) $@ + +COMPONENT_TEST_ENV_CMD = $(ENV) +COMPONENT_TEST_ENV += JAVA_HOME="$(JAVA_HOME)" +COMPONENT_TEST_CMD = $(ANT) + +# test the built source +$(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built + $(RM) -rf $(COMPONENT_TEST_BUILD_DIR) + $(MKDIR) $(COMPONENT_TEST_BUILD_DIR) + $(COMPONENT_PRE_TEST_ACTION) + -(cd $(COMPONENT_TEST_DIR) ; \ + $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \ + $(COMPONENT_TEST_CMD) \ + $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \ + &> $(COMPONENT_TEST_OUTPUT) + $(COMPONENT_POST_TEST_ACTION) + $(COMPONENT_TEST_CREATE_TRANSFORMS) + $(COMPONENT_TEST_PERFORM_TRANSFORM) + $(COMPONENT_TEST_COMPARE) + $(COMPONENT_TEST_CLEANUP) + $(TOUCH) $@ + +$(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built + $(COMPONENT_PRE_TEST_ACTION) + (cd $(COMPONENT_TEST_DIR) ; \ + $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \ + $(COMPONENT_TEST_CMD) \ + $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) + $(COMPONENT_POST_TEST_ACTION) + $(COMPONENT_TEST_CLEANUP) + $(TOUCH) $@ + +ifeq ($(strip $(PARFAIT_BUILD)),yes) +parfait: build +else +parfait: + $(MAKE) PARFAIT_BUILD=yes parfait +endif + +clean:: + $(RM) -r $(SOURCE_DIR) $(BUILD_DIR) diff --git a/sample_data/make-rules/attpackagemake.mk b/sample_data/make-rules/attpackagemake.mk new file mode 100644 index 0000000..5d0905f --- /dev/null +++ b/sample_data/make-rules/attpackagemake.mk @@ -0,0 +1,126 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. +# +# +# Rules and Macros for building opens source software that uses AT&T's package +# tool. +# +# To use these rules, include ../make-rules/attpackagemake.mk in your Makefile +# and define "build", "install" targets appropriate to building your component. +# Ex: +# +# build: $(BUILD_32) \ +# $(BUILD_64) +# +# install: $(INSTALL_32) \ +# $(INSTALL_64) +# +# Any additional pre/post configure, build, or install actions can be specified +# in your Makefile by setting them in on of the following macros: +# COMPONENT_PRE_BUILD_ACTION, COMPONENT_POST_BUILD_ACTION +# COMPONENT_PRE_INSTALL_ACTION, COMPONENT_POST_INSTALL_ACTION +# +# If component specific make targets need to be used for build or install, they +# can be specified in +# COMPONENT_BUILD_TARGETS, COMPONENT_INSTALL_TARGETS +# + +# Environment variables and arguments passed into the build and install +# environment(s). These are the initial settings. +COMPONENT_BUILD_ENV += \ + CC_EXPLICIT="$(CC)" \ + PATH=$(shell dirname $(CC)):$(PATH) \ + CC=$(shell basename $(CC)) + NPROC="$(NPROC)" + +# This explicitly exports the build type for 32/64 bit distinction +COMPONENT_BUILD_ARGS = \ + HOSTTYPE="$(HOSTTYPE$(BITS))" \ + CCFLAGS="$(CFLAGS)" \ + LDFLAGS="$(CXXFLAGS)" + +# The install and test process needs the same environment as the build +COMPONENT_INSTALL_ENV = $(COMPONENT_BUILD_ENV) +COMPONENT_TEST_ENV = $(COMPONENT_BUILD_ENV) +COMPONENT_INSTALL_ARGS = HOSTTYPE="$(HOSTTYPE$(BITS))" +COMPONENT_TEST_ARGS = HOSTTYPE="$(HOSTTYPE$(BITS))" + +# build the configured source +$(BUILD_DIR)/%/.built: $(SOURCE_DIR)/.prep + $(RM) -r $(@D) ; $(MKDIR) $(@D) + $(CLONEY) $(SOURCE_DIR) $(@D) + $(COMPONENT_PRE_BUILD_ACTION) + cd $(@D); $(ENV) $(COMPONENT_BUILD_ENV) \ + bin/package make $(COMPONENT_BUILD_TARGETS) $(COMPONENT_BUILD_ARGS) + $(COMPONENT_POST_BUILD_ACTION) +ifeq ($(strip $(PARFAIT_BUILD)),yes) + -$(PARFAIT) $(@D) +endif + $(TOUCH) $@ + +# install the built source into a prototype area +$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built + $(COMPONENT_PRE_INSTALL_ACTION) + $(RM) -r $(PROTO_DIR)/$(MACH$(BITS)); $(MKDIR) $(PROTO_DIR)/$(MACH$(BITS)); + cd $(@D); $(ENV) $(COMPONENT_INSTALL_ENV) \ + bin/package flat $(COMPONENT_INSTALL_TARGETS) \ + $(COMPONENT_INSTALL_ARGS) \ + $(PROTO_DIR)/$(MACH$(BITS)) $(COMPONENT_INSTALL_PACKAGES) + $(COMPONENT_POST_INSTALL_ACTION) + $(TOUCH) $@ + +# test the built source +$(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built + $(RM) -rf $(COMPONENT_TEST_BUILD_DIR) + $(MKDIR) $(COMPONENT_TEST_BUILD_DIR) + $(COMPONENT_PRE_TEST_ACTION) + -(cd $(COMPONENT_TEST_DIR) ; \ + $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \ + bin/package test $(COMPONENT_TEST_TARGETS) \ + $(COMPONENT_TEST_ARGS) \ + &> $(COMPONENT_TEST_OUTPUT) + $(COMPONENT_POST_TEST_ACTION) + $(COMPONENT_TEST_CREATE_TRANSFORMS) + $(COMPONENT_TEST_PERFORM_TRANSFORM) + $(COMPONENT_TEST_COMPARE) + $(COMPONENT_TEST_CLEANUP) + $(TOUCH) $@ + +$(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built + $(COMPONENT_PRE_TEST_ACTION) + (cd $(COMPONENT_TEST_DIR) ; \ + $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \ + bin/package test $(COMPONENT_TEST_TARGETS) \ + $(COMPONENT_TEST_ARGS) + $(COMPONENT_POST_TEST_ACTION) + $(COMPONENT_TEST_CLEANUP) + $(TOUCH) $@ + +ifeq ($(strip $(PARFAIT_BUILD)),yes) +parfait: build +else +parfait: + $(MAKE) PARFAIT_BUILD=yes parfait +endif + +clean:: + $(RM) -r $(BUILD_DIR) $(PROTO_DIR) diff --git a/sample_data/make-rules/cmake.mk b/sample_data/make-rules/cmake.mk new file mode 100644 index 0000000..98cd88d --- /dev/null +++ b/sample_data/make-rules/cmake.mk @@ -0,0 +1,232 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright 2011 EveryCity Ltd. All rights reserved. +# Copyright 2013 Aurelien Larcher. All rights reserved. +# + +# +# Rules and Macros for building open source software that uses the CMake utility +# from Kitware (http://www.cmake.org) to configure the build. +# This file implements the same rules as configure.mk and thus uses GNU Make +# to build the components with support of multiple version (32/64 bit). +# +# To use these rules, include ../make-rules/cmake.mk in your Makefile +# and define "build", "install", and "test" targets appropriate to building +# your component. +# Ex: +# +# build: $(SOURCE_DIR)/build/$(MACH32)/.built \ +# $(SOURCE_DIR)/build/$(MACH64)/.built +# +# install: $(SOURCE_DIR)/build/$(MACH32)/.installed \ +# $(SOURCE_DIR)/build/$(MACH64)/.installed +# +# test: $(SOURCE_DIR)/build/$(MACH32)/.tested \ +# $(SOURCE_DIR)/build/$(MACH64)/.tested +# +# Any additional pre/post configure, build, or install actions can be specified +# in your make file by setting them in on of the following macros: +# COMPONENT_PRE_CMAKE_ACTION, COMPONENT_POST_CMAKE_ACTION +# COMPONENT_PRE_BUILD_ACTION, COMPONENT_POST_BUILD_ACTION +# COMPONENT_PRE_INSTALL_ACTION, COMPONENT_POST_INSTALL_ACTION +# COMPONENT_PRE_TEST_ACTION, COMPONENT_POST_TEST_ACTION +# +# If component specific make targets need to be used for build or install, they +# can be specified in +# COMPONENT_BUILD_TARGETS, COMPONENT_INSTALL_TARGETS +# COMPONENT_TEST_TARGETS +# + +CMAKE_PREFIX = /usr + +# +# Define path the same way as configure.mk +# Ref: http://www.cmake.org/cmake/help/v2.8.12/cmake.html#module:GNUInstallDirs +# + +ifeq ($(strip $(PREFERRED_BITS)),64) +CMAKE_BINDIR.32 = bin/$(MACH32) +CMAKE_BINDIR.64 = bin +CMAKE_SBINDIR.32 = sbin/$(MACH32) +CMAKE_SBINDIR.64 = sbin +else +CMAKE_BINDIR.32 = bin +CMAKE_BINDIR.64 = bin/$(MACH64) +CMAKE_SBINDIR.32 = sbin +CMAKE_SBINDIR.64 = sbin/$(MACH64) +endif +CMAKE_LIBDIR.32 = lib +CMAKE_LIBDIR.64 = lib/$(MACH64) +CMAKE_LIBEXECDIR.32 = lib +CMAKE_LIBEXECDIR.64 = lib/$(MACH64) +CMAKE_INCLUDEDIR = include +CMAKE_DATAROOTDIR = share +CMAKE_DATADIR = $(CMAKE_DATAROOTDIR) +CMAKE_INFODIR = $(CMAKE_DATAROOTDIR)/info +CMAKE_LOCALEDIR = $(CMAKE_DATAROOTDIR)/locale +CMAKE_MANDIR = $(CMAKE_DATAROOTDIR)/man +CMAKE_DOCDIR = $(CMAKE_DATAROOTDIR)/doc + +CMAKE_ENV = CONFIG_SHELL="$(CONFIG_SHELL)" +CMAKE_ENV += CC="$(CC)" +CMAKE_ENV += CXX="$(CXX)" +CMAKE_ENV += F77="$(F77)" +CMAKE_ENV += FC="$(FC)" +CMAKE_ENV += CFLAGS="$(CFLAGS)" +CMAKE_ENV += CXXFLAGS="$(CXXFLAGS)" +CMAKE_ENV += FFLAGS="$(F77FLAGS)" +CMAKE_ENV += FCFLAGS="$(FCFLAGS)" +CMAKE_ENV += LDFLAGS="$(LDFLAGS)" +CMAKE_ENV += PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" + +# Rewrite absolute source-code paths into relative for ccache, so that any +# workspace with a shared CCACHE_DIR can benefit when compiling a component +ifneq ($(strip $(CCACHE)),) +CMAKE_ENV += CCACHE="$(CCACHE)" +CMAKE_ENV += CC_gcc_32="$(CC_gcc_32)" +CMAKE_ENV += CC_gcc_64="$(CC_gcc_32)" +CMAKE_ENV += CXX_gcc_32="$(CXX_gcc_64)" +CMAKE_ENV += CXX_gcc_64="$(CXX_gcc_64)" +CMAKE_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))" + +ifneq ($(strip $(CCACHE_DIR)),) +CMAKE_ENV += CCACHE_DIR="$(CCACHE_DIR)" +endif + +ifneq ($(strip $(CCACHE_LOGFILE)),) +CMAKE_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)" +endif + +endif + +CMAKE_DEFAULT_DIRS?=yes + +CMAKE_OPTIONS += -DCMAKE_C_COMPILER:STRING="$(CC)" +CMAKE_OPTIONS += -DCMAKE_CXX_COMPILER:STRING="$(CXX)" +CMAKE_OPTIONS += -DCMAKE_Fortran_COMPILER:STRING="$(FC)" +CMAKE_OPTIONS += -DCMAKE_C_FLAGS:STRING="$(CFLAGS)" +CMAKE_OPTIONS += -DCMAKE_CXX_FLAGS:STRING="$(CXXFLAGS)" +CMAKE_OPTIONS += -DCMAKE_Fortran_FLAGS:STRING="$(FCFLAGS)" + +CMAKE_OPTIONS += LDFLAGS="$(LDFLAGS)" +CMAKE_OPTIONS += PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" + +CMAKE_OPTIONS += -DCMAKE_INSTALL_PREFIX:PATH=$(CMAKE_PREFIX) +ifeq ($(CMAKE_DEFAULT_DIRS),yes) +CMAKE_OPTIONS += -DCMAKE_INSTALL_BINDIR:PATH=$(CMAKE_BINDIR.$(BITS)) +CMAKE_OPTIONS += -DCMAKE_INSTALL_LIBDIR:PATH=$(CMAKE_LIBDIR.$(BITS)) +CMAKE_OPTIONS += -DCMAKE_INSTALL_SBINDIR:PATH=$(CMAKE_SBINDIR.$(BITS)) +CMAKE_OPTIONS += -DCMAKE_INSTALL_DATAROOTDIR:PATH=$(CMAKE_DATAROOTDIR) +CMAKE_OPTIONS += -DCMAKE_INSTALL_DATADIR:PATH=$(CMAKE_DATAROOTDIR) +CMAKE_OPTIONS += -DCMAKE_INSTALL_INFODIR:PATH=$(CMAKE_INFODIR) +CMAKE_OPTIONS += -DCMAKE_INSTALL_LOCALEDIR:PATH=$(CMAKE_LOCALEDIR) +CMAKE_OPTIONS += -DCMAKE_INSTALL_MANDIR:PATH=$(CMAKE_MANDIR) + +CMAKE_OPTIONS += -DLIBEXEC_INSTALL_DIR="$(CMAKE_PREFIX)/$(CMAKE_LIBEXECDIR.$(BITS))" + +# Some components use LIB_INSTALL_DIR or CMAKE_INSTALL_LIBDIR, as-is, +# others forcibly ignore it and set +# based on CMAKE_INSTALL_PREFIX. Those usually instead offer a LIB_SUFFIX +# variable that we can generally use to accomplish the same result. Setting +# them both shouldn't harm anything. +CMAKE_OPTIONS += -DLIB_INSTALL_DIR="$(CMAKE_PREFIX)/$(CMAKE_LIBDIR.$(BITS))" +CMAKE_OPTIONS.64 += -DLIB_SUFFIX="/$(MACH64)" +endif +CMAKE_OPTIONS += $(CMAKE_OPTIONS.$(BITS)) + +COMPONENT_INSTALL_ARGS += DESTDIR=$(PROTO_DIR) + +$(BUILD_DIR_32)/.configured: BITS=32 +$(BUILD_DIR_64)/.configured: BITS=64 + +CMAKE_ENV += $(CMAKE_ENV.$(BITS)) + +COMPONENT_TEST_CMD=ctest +COMPONENT_TEST_TARGETS= + +# configure the unpacked source for building 32 and 64 bit version +CMAKE = cmake +$(BUILD_DIR)/%/.configured: $(SOURCE_DIR)/.prep + ($(RM) -rf $(@D) ; $(MKDIR) $(@D)) + $(COMPONENT_PRE_CMAKE_ACTION) + (cd $(@D) ; $(ENV) $(CMAKE_ENV) \ + $(CMAKE) $(CMAKE_OPTIONS) $(SOURCE_DIR)) + $(COMPONENT_POST_CMAKE_ACTION) + $(TOUCH) $@ + +# build the configured source +$(BUILD_DIR)/%/.built: $(BUILD_DIR)/%/.configured + $(COMPONENT_PRE_BUILD_ACTION) + (cd $(@D) ; $(ENV) $(COMPONENT_BUILD_ENV) \ + $(GMAKE) $(COMPONENT_BUILD_GMAKE_ARGS) $(COMPONENT_BUILD_ARGS) \ + $(COMPONENT_BUILD_TARGETS)) + $(COMPONENT_POST_BUILD_ACTION) +ifeq ($(strip $(PARFAIT_BUILD)),yes) + -$(PARFAIT) build +endif + $(TOUCH) $@ + +# install the built source into a prototype area +$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built + $(COMPONENT_PRE_INSTALL_ACTION) + (cd $(@D) ; $(ENV) $(COMPONENT_INSTALL_ENV) $(GMAKE) \ + $(COMPONENT_INSTALL_ARGS) $(COMPONENT_INSTALL_TARGETS)) + $(COMPONENT_POST_INSTALL_ACTION) + $(TOUCH) $@ + +# test the built source +$(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built + $(RM) -rf $(COMPONENT_TEST_BUILD_DIR) + $(MKDIR) $(COMPONENT_TEST_BUILD_DIR) + $(COMPONENT_PRE_TEST_ACTION) + -(cd $(COMPONENT_TEST_DIR) ; \ + $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \ + $(COMPONENT_TEST_CMD) \ + $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \ + &> $(COMPONENT_TEST_OUTPUT) + $(COMPONENT_POST_TEST_ACTION) + $(COMPONENT_TEST_CREATE_TRANSFORMS) + $(COMPONENT_TEST_PERFORM_TRANSFORM) + $(COMPONENT_TEST_COMPARE) + $(COMPONENT_TEST_CLEANUP) + $(TOUCH) $@ + +$(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built + $(COMPONENT_PRE_TEST_ACTION) + (cd $(COMPONENT_TEST_DIR) ; \ + $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \ + $(COMPONENT_TEST_CMD) \ + $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) + $(COMPONENT_POST_TEST_ACTION) + $(COMPONENT_TEST_CLEANUP) + $(TOUCH) $@ + +ifeq ($(strip $(PARFAIT_BUILD)),yes) +parfait: install + -$(PARFAIT) build +else +parfait: + $(MAKE) PARFAIT_BUILD=yes parfait +endif + +clean:: + $(RM) -r $(BUILD_DIR) $(PROTO_DIR) diff --git a/sample_data/make-rules/common-lisp.mk b/sample_data/make-rules/common-lisp.mk new file mode 100644 index 0000000..3e9ff64 --- /dev/null +++ b/sample_data/make-rules/common-lisp.mk @@ -0,0 +1,46 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"). You may +# only use this file in accordance with the terms 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 2015 Josef 'Jeff' Sipek +# + +# +# Rules to install a common lisp library package. +# +# To use these rules, just include ../make-rules/common-lisp.mk in your +# Makefile and define "build" and "install" targets. E.g., +# +# build: $(BUILD_32) +# +# install: $(INSTALL_32) +# +# Since common lisp libraries are all source code, there is no need for +# BUILD_64 and INSTALL_64. + +INSTALL_DIR = $(PROTOCLDIR)/source/$(COMPONENT_NAME) + +$(BUILD_DIR)/%/.built: $(SOURCE_DIR)/.prep + $(MKDIR) $(@D) + $(TOUCH) $@ + +$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built + $(MKDIR) $(PROTOCLDIR) + $(MKDIR) $(PROTOCLDIR)/source + $(MKDIR) $(PROTOCLDIR)/systems + $(MKDIR) $(INSTALL_DIR) + $(CP) -a $(SOURCE_DIR)/* $(INSTALL_DIR) + (cd $(PROTOCLDIR)/systems; \ + $(RM) $(COMPONENT_NAME).asd; \ + $(LN) -s ../source/$(COMPONENT_NAME)/$(COMPONENT_NAME).asd) + $(TOUCH) $@ + +clean:: + $(RM) -r $(BUILD_DIR) $(PROTO_DIR) diff --git a/sample_data/make-rules/common.mk b/sample_data/make-rules/common.mk new file mode 100644 index 0000000..e6eff38 --- /dev/null +++ b/sample_data/make-rules/common.mk @@ -0,0 +1,191 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. +# + +# +# This file sets up the standard, default options and base requirements for +# userland components. +# + +include $(WS_MAKE_RULES)/prep.mk + +# Override this to limit builds and publication to a single architecture. +BUILD_ARCH ?= $(MACH) +ifneq ($(strip $(BUILD_ARCH)),$(MACH)) +PUBLISH_STAMP= + +target-na: + @echo "Not available for $(MACH)" + +BUILD_TARGET ?= target-na +INSTALL_TARGET ?= target-na +TEST_TARGET ?= target-na +SYSTEM_TEST_TARGET ?= target-na +endif + +# Assume components use a configure script-style build by default. +BUILD_STYLE ?= configure +# If not an archive build (i.e. extract and copy) or pkg build (publish only), +# include relevant makefile. +ifneq ($(strip $(BUILD_STYLE)),archive) +ifneq ($(strip $(BUILD_STYLE)),pkg) +include $(WS_MAKE_RULES)/$(strip $(BUILD_STYLE)).mk +endif +endif + +ifeq ($(strip $(BUILD_STYLE)),configure) +# Assume these items should always be set in the configure environment. strip +# is used to work around potential problems with extra blank characters +# inserted into strings during nested configure invocations within builds for +# components such as gdb. +ifneq ($(strip $(CFLAGS)),) +# Only if provided. +CONFIGURE_ENV += CFLAGS="$(strip $(CFLAGS))" +endif +ifneq ($(strip $(CXXFLAGS)),) +# Only if provided. +CONFIGURE_ENV += CXXFLAGS="$(strip $(CXXFLAGS))" +endif +# Always process LDFLAGS. +CONFIGURE_ENV += LDFLAGS="$(strip $(LDFLAGS))" +endif + +ifeq ($(strip $(BUILD_STYLE)),justmake) +# Assume these items should always be set in the build environment. +COMPONENT_BUILD_ENV += CC="$(CC)" +COMPONENT_BUILD_ENV += CXX="$(CXX)" +ifneq ($(strip $(CFLAGS)),) +# Only if provided. +COMPONENT_BUILD_ENV += CFLAGS="$(strip $(CFLAGS))" +endif +ifneq ($(strip $(CXXFLAGS)),) +# Only if provided. +COMPONENT_BUILD_ENV += CXXFLAGS="$(strip $(CXXFLAGS))" +endif +# Always process LDFLAGS. +COMPONENT_BUILD_ENV += LDFLAGS="$(strip $(LDFLAGS))" +endif + +# Assume components built with ant do not need ASLR. +ifeq ($(strip $(BUILD_STYLE)),ant) +ASLR_MODE= $(ASLR_NOT_APPLICABLE) +else +ifeq ($(strip $(DEFAULT_ASLR_ENABLE)),yes) +# Enable ASLR by default unless target build is NO_ARCH. +ifneq ($(strip $(BUILD_BITS)),NO_ARCH) +ASLR_MODE= $(ASLR_ENABLE) +endif # DEFAULT_ASLR_ENABLE yes +endif # BUILD_BITS NO_ARCH +endif # BUILD_STYLE ant + +# Default targets; to omit a specific target, explicitly set the related target +# variable to empty before including this file or set COMMON_TARGETS=no. +COMMON_TARGETS ?= yes + +ifneq ($(strip $(COMMON_TARGETS)),no) +# For ant-based build style, assume that install is provided by simply building +# the component and that no tests are available. +ifeq ($(strip $(BUILD_STYLE)),ant) +INSTALL_TARGET ?= build +TEST_TARGET ?= $(NO_TESTS) +SYSTEM_TEST_TARGET ?= $(NO_TESTS) +endif + +# For archive-based build style, assume that the build, install, and test +# targets will be provided. +ifeq ($(strip $(BUILD_STYLE)),archive) +BUILD_TARGET ?= +INSTALL_TARGET ?= +TEST_TARGET ?= +endif + +# For pkg-based build style, assume there are no build, install, or test steps; +# just a package to be published. +ifeq ($(strip $(BUILD_STYLE)),pkg) +BUILD_TARGET= +INSTALL_TARGET= +TEST_TARGET= +SYSTEM_TEST_TARGET= +build install: +test system-test: $(NO_TESTS) +endif + +# If TEST_TARGET is NO_TESTS, assume no system tests by default. +ifeq ($(strip $(TEST_TARGET)),$(NO_TESTS)) +SYSTEM_TEST_TARGET ?= $(NO_TESTS) +endif + +# If TEST_TARGET is SKIP_TEST, assume system tests are skipped by default. +ifeq ($(strip $(TEST_TARGET)),$(SKIP_TEST)) +SYSTEM_TEST_TARGET ?= $(SKIP_TEST) +endif + +# Otherwise, attempt to define common targets assuming defaults. +BUILD_TARGET ?= $(BUILD_$(MK_BITS)) +ifneq ($(strip $(BUILD_TARGET)),) +build: $(BUILD_TARGET) +endif + +INSTALL_TARGET ?= $(INSTALL_$(MK_BITS)) +ifneq ($(strip $(INSTALL_TARGET)),) +install: $(INSTALL_TARGET) +endif + +TEST_TARGET ?= $(TEST_$(MK_BITS)) +ifneq ($(strip $(TEST_TARGET)),) +test: $(TEST_TARGET) +endif + +# For the system-test target, assume that none have been implemented. +SYSTEM_TEST_TARGET ?= $(SYSTEM_TESTS_NOT_IMPLEMENTED) +ifneq ($(strip $(SYSTEM_TEST_TARGET)),) +system-test: $(SYSTEM_TEST_TARGET) +endif +endif # COMMON_TARGETS + +# Always needed; every component builds packages. +include $(WS_MAKE_RULES)/ips.mk + +# Determine if we should automatically add files directory to PKG_PROTO_DIRS. +ifeq ($(wildcard files),files) +PKG_PROTO_DIRS += $(COMPONENT_DIR)/files +endif + +# Add bit and mach-specific logic to general actions. +COMPONENT_PRE_CONFIGURE_ACTION += $(COMPONENT_PRE_CONFIGURE_ACTION.$(BITS)) +COMPONENT_PRE_CONFIGURE_ACTION += $(COMPONENT_PRE_CONFIGURE_ACTION.$(MACH)) +COMPONENT_POST_CONFIGURE_ACTION += $(COMPONENT_POST_CONFIGURE_ACTION.$(BITS)) +COMPONENT_POST_CONFIGURE_ACTION += $(COMPONENT_POST_CONFIGURE_ACTION.$(MACH)) +COMPONENT_PRE_BUILD_ACTION += $(COMPONENT_PRE_BUILD_ACTION.$(BITS)) +COMPONENT_PRE_BUILD_ACTION += $(COMPONENT_PRE_BUILD_ACTION.$(MACH)) +COMPONENT_POST_BUILD_ACTION += $(COMPONENT_POST_BUILD_ACTION.$(BITS)) +COMPONENT_POST_BUILD_ACTION += $(COMPONENT_POST_BUILD_ACTION.$(MACH)) +COMPONENT_PRE_INSTALL_ACTION += $(COMPONENT_PRE_INSTALL_ACTION.$(BITS)) +COMPONENT_PRE_INSTALL_ACTION += $(COMPONENT_PRE_INSTALL_ACTION.$(MACH)) +COMPONENT_POST_INSTALL_ACTION += $(COMPONENT_POST_INSTALL_ACTION.$(BITS)) +COMPONENT_POST_INSTALL_ACTION += $(COMPONENT_POST_INSTALL_ACTION.$(MACH)) +COMPONENT_PRE_TEST_ACTION += $(COMPONENT_PRE_TEST_ACTION.$(BITS)) +COMPONENT_PRE_TEST_ACTION += $(COMPONENT_PRE_TEST_ACTION.$(MACH)) +COMPONENT_POST_TEST_ACTION += $(COMPONENT_POST_TEST_ACTION.$(BITS)) +COMPONENT_POST_TEST_ACTION += $(COMPONENT_POST_TEST_ACTION.$(MACH)) diff --git a/sample_data/make-rules/component-report b/sample_data/make-rules/component-report new file mode 100644 index 0000000..bcbcfd1 --- /dev/null +++ b/sample_data/make-rules/component-report @@ -0,0 +1,56 @@ + +PKG_REPORTS=$(CANONICAL_MANIFESTS:%.p5m=$(BUILD_DIR)/%.pkg-report) + +HGWEB_BASE_URL = http://userland.us.oracle.com/hg/file/tip/ +ARIA_BASE_URL = http://people.us.oracle.com/pls/oracle/find_person?p_string= +ARC_BASE_URL = http://psarc.us.oracle.com/ +BUGDB_URL = http://userland.us.oracle.com/bugdb?cat-subcat= + +REPORT_TRANSFORMS = $(WS_TOP)/transforms/report +CDIR=$(COMPONENT_DIR:$(WS_TOP)/%=%) + +component-report: $(BUILD_DIR)/component-report + +$(BUILD_DIR)/component-report: $(BUILD_DIR)/package-info + @echo "" >$@ + @echo "$(COMPONENT_NAME)" >>$@ + @echo "$(COMPONENT_VERSION)" >>$@ + @echo "$(CDIR)" >>$@ + @echo "" >>$@ ; for pkg in $(PACKAGE) ; do \ + echo "$$pkg
" >>$@ ; \ + done ; echo "" >>$@ + @echo "" >>$@ ; for arc in $(ARC_CASE) ; do \ + echo "$$arc
" >>$@ ; \ + done ; echo "" >>$@ + @echo "" >>$@ ; for license in $(LICENSE) ; do \ + echo "$$license
" >>$@ ; \ + done ; echo "" >>$@ + @echo "$(TPNO)" >>$@ + @echo "" >>$@ ; for bugdb in $(COMPONENT_BUGDB) ; do \ + echo "$$bugdb
" >>$@ ; \ + done ; echo "" >>$@ + @echo "$(RESPONSIBLE_ENGINEER)" >>$@ + @echo "$(RESPONSIBLE_MANAGER)" >>$@ + @echo "$(TEAM)" >>$@ + @echo "" >>$@ + +$(BUILD_DIR)/package-info: $(PKG_REPORTS) + @cat $(PKG_REPORTS) | sort -u >$@ + +$(BUILD_DIR)/component-info: $(PKG_REPORTS) + @echo "COMPONENT_NAME=\"$(COMPONENT_NAME)\"" >$@ + @echo "COMPONENT_VERSION=\"$(COMPONENT_VERSION)\"" >>$@ + @echo "COMPONENT_PROJECT_URL=\"$(COMPONENT_PROJECT_URL)\"" >>$@ + @echo "COMPONENT_ARCHIVE_URL=\"$(COMPONENT_ARCHIVE_URL)\"" >>$@ + @echo "COMPONENT_DIR=\"$(CDIR)\"" >>$@ + @echo "TPNO=\"$(TPNO)\"" >>$@ + @echo "COMPONENT_BUGDB=\"$(COMPONENT_BUGDB)\"" >>$@ + @echo "RESPONSIBLE_ENGINEER=\"$(RESPONSIBLE_ENGINEER)\"" >>$@ + @echo "RESPONSIBLE_MANAGER=\"$(RESPONSIBLE_MANAGER)\"" >>$@ + @echo "TEAM=\"$(TEAM)\"" >>$@ + +$(BUILD_DIR)/%.pkg-report: %.p5m $(BUILD_DIR) + @$(PKGMOGRIFY) $(PKG_OPTIONS) -P $@ $< \ + $(REPORT_TRANSFORMS) >/dev/null + +include $(BUILD_DIR)/package-info diff --git a/sample_data/make-rules/component.mk b/sample_data/make-rules/component.mk new file mode 100644 index 0000000..2f4534b --- /dev/null +++ b/sample_data/make-rules/component.mk @@ -0,0 +1,33 @@ + +# A simple rule to print the value of any macro. Ex: +# $ gmake print-REQUIRED_PACKAGES +# Note that some macros are set on a per target basis, so what you see +# is not always what you get. +print-%: + @echo '$(subst ','\'',$*=$($*)) (origin: $(origin $*), flavor: $(flavor $*))' + +# A simple rule to print only the value of any macro. +print-value-%: + @echo '$(subst ','\'',$($*))' + +# Provide default print package targets for components that do not rely on IPS. +# Define them implicitly so that the definitions do not collide with ips.mk +define print-package-rule +echo $(strip $(PACKAGE_$(1))) | tr ' ' '\n' +endef + + +COMPONENT_TOOL = $(WS_TOOLS)/userland-component + +format: + @$(COMPONENT_TOOL) --path $(COMPONENT_DIR); + +update: + @if [ "$(VERSION)X" = "X" ]; \ + then $(COMPONENT_TOOL) --path $(COMPONENT_DIR) --bump; \ + else $(COMPONENT_TOOL) --path $(COMPONENT_DIR) --bump $(VERSION); \ + fi; + +update-latest: + $(COMPONENT_TOOL) --path $(COMPONENT_DIR) --bump latest; + diff --git a/sample_data/make-rules/configure.mk b/sample_data/make-rules/configure.mk new file mode 100644 index 0000000..4418455 --- /dev/null +++ b/sample_data/make-rules/configure.mk @@ -0,0 +1,249 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright 2011 EveryCity Ltd. All rights reserved. +# + +# +# Rules and Macros for building opens source software that uses configure / +# GNU auto* tools to configure their build for the system they are on. This +# uses GNU Make to build the components to take advantage of the viewpath +# support and build multiple version (32/64 bit) from a shared source. +# +# To use these rules, include ../make-rules/configure.mk in your Makefile +# and define "build", "install", and "test" targets appropriate to building +# your component. +# Ex: +# +# build: $(SOURCE_DIR)/build/$(MACH32)/.built \ +# $(SOURCE_DIR)/build/$(MACH64)/.built +# +# install: $(SOURCE_DIR)/build/$(MACH32)/.installed \ +# $(SOURCE_DIR)/build/$(MACH64)/.installed +# +# test: $(SOURCE_DIR)/build/$(MACH32)/.tested \ +# $(SOURCE_DIR)/build/$(MACH64)/.tested +# +# Any additional pre/post configure, build, or install actions can be specified +# in your make file by setting them in on of the following macros: +# COMPONENT_PRE_CONFIGURE_ACTION, COMPONENT_POST_CONFIGURE_ACTION +# COMPONENT_PRE_BUILD_ACTION, COMPONENT_POST_BUILD_ACTION +# COMPONENT_PRE_INSTALL_ACTION, COMPONENT_POST_INSTALL_ACTION +# COMPONENT_PRE_TEST_ACTION, COMPONENT_POST_TEST_ACTION +# +# If component specific make targets need to be used for build or install, they +# can be specified in +# COMPONENT_BUILD_TARGETS, COMPONENT_INSTALL_TARGETS +# COMPONENT_TEST_TARGETS +# + +CONFIGURE_PREFIX = /usr + +# If the component prefers 64-bit binaries, then ensure builds deliver 64-bit +# binaries to the standard directories and 32-bit binaries to the non-standard +# location. This allows simplification of package manifests and makes it +# easier to deliver the 64-bit binaries as the default. +ifeq ($(strip $(PREFERRED_BITS)),64) +CONFIGURE_BINDIR.32 = $(CONFIGURE_PREFIX)/bin/$(MACH32) +CONFIGURE_BINDIR.64 = $(CONFIGURE_PREFIX)/bin +CONFIGURE_SBINDIR.32 = $(CONFIGURE_PREFIX)/sbin/$(MACH32) +CONFIGURE_SBINDIR.64 = $(CONFIGURE_PREFIX)/sbin +else +CONFIGURE_BINDIR.32 = $(CONFIGURE_PREFIX)/bin +CONFIGURE_BINDIR.64 = $(CONFIGURE_PREFIX)/bin/$(MACH64) +CONFIGURE_SBINDIR.32 = $(CONFIGURE_PREFIX)/sbin +CONFIGURE_SBINDIR.64 = $(CONFIGURE_PREFIX)/sbin/$(MACH64) +endif + +# Regardless of PREFERRED_BITS, 64-bit libraries should always be delivered to +# the appropriate subdirectory by default. +CONFIGURE_LIBDIR.32 = $(CONFIGURE_PREFIX)/lib +CONFIGURE_LIBDIR.64 = $(CONFIGURE_PREFIX)/lib/$(MACH64) + +CONFIGURE_MANDIR = $(CONFIGURE_PREFIX)/share/man +CONFIGURE_LOCALEDIR = $(CONFIGURE_PREFIX)/share/locale +# all texinfo documentation seems to go to /usr/share/info no matter what +CONFIGURE_INFODIR = /usr/share/info +CONFIGURE_INCLUDEDIR = /usr/include + +CONFIGURE_ENV = CONFIG_SHELL="$(CONFIG_SHELL)" +CONFIGURE_ENV += CC="$(CC)" +CONFIGURE_ENV += CXX="$(CXX)" +CONFIGURE_ENV += F77="$(F77)" +CONFIGURE_ENV += FC="$(FC)" +CONFIGURE_ENV += CFLAGS="$(CFLAGS)" +CONFIGURE_ENV += CXXFLAGS="$(CXXFLAGS)" +CONFIGURE_ENV += FFLAGS="$(F77FLAGS)" +CONFIGURE_ENV += FCFLAGS="$(FCFLAGS)" +CONFIGURE_ENV += LDFLAGS="$(LDFLAGS)" +CONFIGURE_ENV += PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" + +# Rewrite absolute source-code paths into relative for ccache, so that any +# workspace with a shared CCACHE_DIR can benefit when compiling a component +ifneq ($(strip $(CCACHE)),) +CONFIGURE_ENV += CCACHE="$(CCACHE)" +CONFIGURE_OPTIONS += CCACHE="$(CCACHE)" +CONFIGURE_ENV += CC_gcc_32="$(CC_gcc_32)" +CONFIGURE_ENV += CC_gcc_64="$(CC_gcc_32)" +CONFIGURE_ENV += CXX_gcc_32="$(CXX_gcc_64)" +CONFIGURE_ENV += CXX_gcc_64="$(CXX_gcc_64)" +CONFIGURE_OPTIONS += CC_gcc_32="$(CC_gcc_32)" +CONFIGURE_OPTIONS += CC_gcc_64="$(CC_gcc_32)" +CONFIGURE_OPTIONS += CXX_gcc_32="$(CXX_gcc_64)" +CONFIGURE_OPTIONS += CXX_gcc_64="$(CXX_gcc_64)" +CONFIGURE_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))" +CONFIGURE_OPTIONS.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))" + +ifneq ($(strip $(CCACHE_DIR)),) +CONFIGURE_ENV += CCACHE_DIR="$(CCACHE_DIR)" +CONFIGURE_OPTIONS += CCACHE_DIR="$(CCACHE_DIR)" +endif + +ifneq ($(strip $(CCACHE_LOGFILE)),) +CONFIGURE_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)" +CONFIGURE_OPTIONS += CCACHE_LOGFILE="$(CCACHE_LOGFILE)" +endif + +endif + +CONFIGURE_DEFAULT_DIRS?=yes + +CONFIGURE_OPTIONS += CC="$(CC)" +CONFIGURE_OPTIONS += CXX="$(CXX)" +CONFIGURE_OPTIONS += F77="$(F77)" +CONFIGURE_OPTIONS += FC="$(FC)" +CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" +CONFIGURE_OPTIONS += CXXFLAGS="$(CXXFLAGS)" +CONFIGURE_OPTIONS += FFLAGS="$(F77FLAGS)" +CONFIGURE_OPTIONS += FCFLAGS="$(FCFLAGS)" +CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)" +CONFIGURE_OPTIONS += PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" + +CONFIGURE_OPTIONS += --prefix=$(CONFIGURE_PREFIX) +ifeq ($(CONFIGURE_DEFAULT_DIRS),yes) +CONFIGURE_OPTIONS += --mandir=$(CONFIGURE_MANDIR) +CONFIGURE_OPTIONS += --bindir=$(CONFIGURE_BINDIR.$(BITS)) +CONFIGURE_OPTIONS += --libdir=$(CONFIGURE_LIBDIR.$(BITS)) +CONFIGURE_OPTIONS += --sbindir=$(CONFIGURE_SBINDIR.$(BITS)) +endif +CONFIGURE_OPTIONS += $(CONFIGURE_OPTIONS.$(BITS)) + +COMPONENT_INSTALL_ARGS += DESTDIR=$(PROTO_DIR) + +$(BUILD_DIR_32)/.configured: BITS=32 +$(BUILD_DIR_64)/.configured: BITS=64 + +CONFIGURE_ENV += $(CONFIGURE_ENV.$(BITS)) +ifeq ($(strip $(PARFAIT_BUILD)),yes) +# parfait creates '*.bc' files which can confuse configure's +# object/exe extension detection. which we really don't need it +# to do anyway, so we'll just tell it what they are. +CONFIGURE_ENV += ac_cv_objext=o +CONFIGURE_ENV += ac_cv_exeext="" +# this is fixed in the clang compiler but we can't use it yet +CONFIGURE_ENV += ac_cv_header_stdbool_h=yes +endif + + +# temporarily work around some issues +CONFIGURE_ENV += "ac_cv_func_realloc_0_nonnull=yes" +COMPONENT_BUILD_ENV += "ac_cv_func_realloc_0_nonnull=yes" + +# configure the unpacked source for building 32 and 64 bit version +CONFIGURE_SCRIPT = $(SOURCE_DIR)/configure +$(BUILD_DIR)/%/.configured: $(SOURCE_DIR)/.prep + ($(RM) -rf $(@D) ; $(MKDIR) $(@D)) + $(COMPONENT_PRE_CONFIGURE_ACTION) + (cd $(@D) ; $(ENV) $(CONFIGURE_ENV) $(CONFIG_SHELL) \ + $(CONFIGURE_SCRIPT) $(CONFIGURE_OPTIONS)) + $(COMPONENT_POST_CONFIGURE_ACTION) + $(TOUCH) $@ + +# build the configured source +$(BUILD_DIR)/%/.built: $(BUILD_DIR)/%/.configured + $(COMPONENT_PRE_BUILD_ACTION) + (cd $(@D) ; $(ENV) $(COMPONENT_BUILD_ENV) \ + $(GMAKE) $(COMPONENT_BUILD_GMAKE_ARGS) $(COMPONENT_BUILD_ARGS) \ + $(COMPONENT_BUILD_TARGETS)) + $(COMPONENT_POST_BUILD_ACTION) +ifeq ($(strip $(PARFAIT_BUILD)),yes) + -$(PARFAIT) build +endif + $(TOUCH) $@ + +# install the built source into a prototype area +$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built + $(COMPONENT_PRE_INSTALL_ACTION) + (cd $(@D) ; $(ENV) $(COMPONENT_INSTALL_ENV) $(GMAKE) \ + $(COMPONENT_INSTALL_ARGS) $(COMPONENT_INSTALL_TARGETS)) + $(COMPONENT_POST_INSTALL_ACTION) + $(TOUCH) $@ + +CONFIGURE_TEST_TRANSFORMS = \ + '-n ' \ + '-e "/TOTAL:/p" ' \ + '-e "/SKIP:/p" ' \ + '-e "/PASS:/p" ' \ + '-e "/FAIL:/p" ' \ + '-e "/ERROR:/p" ' + +USE_DEFAULT_TEST_TRANSFORMS?=no +ifeq ($(strip $(USE_DEFAULT_TEST_TRANSFORMS)),yes) +COMPONENT_TEST_TRANSFORMS+= $(CONFIGURE_TEST_TRANSFORMS) +endif + +# test the built source +$(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built + $(RM) -rf $(COMPONENT_TEST_BUILD_DIR) + $(MKDIR) $(COMPONENT_TEST_BUILD_DIR) + $(COMPONENT_PRE_TEST_ACTION) + -(cd $(COMPONENT_TEST_DIR) ; \ + $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \ + $(COMPONENT_TEST_CMD) \ + $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \ + &> $(COMPONENT_TEST_OUTPUT) + $(COMPONENT_POST_TEST_ACTION) + $(COMPONENT_TEST_CREATE_TRANSFORMS) + $(COMPONENT_TEST_PERFORM_TRANSFORM) + $(COMPONENT_TEST_COMPARE) + $(COMPONENT_TEST_CLEANUP) + $(TOUCH) $@ + +$(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built + $(COMPONENT_PRE_TEST_ACTION) + (cd $(COMPONENT_TEST_DIR) ; \ + $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \ + $(COMPONENT_TEST_CMD) \ + $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) + $(COMPONENT_POST_TEST_ACTION) + $(COMPONENT_TEST_CLEANUP) + $(TOUCH) $@ + +ifeq ($(strip $(PARFAIT_BUILD)),yes) +parfait: install + -$(PARFAIT) build +else +parfait: + $(MAKE) PARFAIT_BUILD=yes parfait +endif + +clean:: + $(RM) -r $(BUILD_DIR) $(PROTO_DIR) diff --git a/sample_data/make-rules/depend.mk b/sample_data/make-rules/depend.mk new file mode 100644 index 0000000..3917f61 --- /dev/null +++ b/sample_data/make-rules/depend.mk @@ -0,0 +1,25 @@ +# +# 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 2018 Adam Stevko +# + +print-required-packages:: + @for package in $(REQUIRED_PACKAGES) ; do \ + echo $$package ; \ + done | LANG=C LC_ALL=C sort -u + +# update the metadata for current component +update-metadata: + @echo "generating metadata: $(CURDIR:$(WS_TOP)/components/%=%)" + @$(BASS_O_MATIC) --workspace=$(WS_TOP) --pkg5 + diff --git a/sample_data/make-rules/encumbered.mk b/sample_data/make-rules/encumbered.mk new file mode 100644 index 0000000..85d1ff8 --- /dev/null +++ b/sample_data/make-rules/encumbered.mk @@ -0,0 +1,24 @@ +# +# 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 2015 Alexander Pyhalov +# + +WS_REPO = $(WS_TOP)/$(MACH)/encumbered-repo + +COMPONENT_PKGLINT_ENV += ENCUMBERED=true + +PUBLISHER = hipster-encumbered + +BASS_O_MATIC = $(WS_TOOLS)/bass-o-matic --subdir=components/encumbered + +ENCUMBERED = encumbered/ diff --git a/sample_data/make-rules/environment.mk b/sample_data/make-rules/environment.mk new file mode 100644 index 0000000..95d2410 --- /dev/null +++ b/sample_data/make-rules/environment.mk @@ -0,0 +1,119 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2020, Adam Stevko +# + +PFEXEC = /usr/bin/pfexec + +ZONE = $(WS_TOOLS)/userland-zone + +define separator-line + @$(PYTHON) -c 'l="="*int(40-len("$1")/2); print("%s%s%s" % (l, "$1", l))' +endef + +component-environment-check:: + $(call separator-line,Workspace) + @echo " Path: $(WS_TOP)" + @echo " Branch: $$(git rev-parse --abbrev-ref HEAD)" + @echo " Changeset: $$(git rev-parse HEAD)" + $(call separator-line,System) + @/usr/bin/uname -a + @echo "Zone: $$(/usr/bin/zonename)" + @echo "Zone IP type: $$(/usr/bin/zonename -t)" + @/usr/sbin/psrinfo -vp + @/usr/sbin/ipadm show-addr + $(call separator-line,Required Packages) + @/usr/bin/pkg list -vH $(USERLAND_REQUIRED_PACKAGES:%=/%) $(REQUIRED_PACKAGES:%=/%) + $(call separator-line) + +component-environment-prep:: + @/usr/bin/pkg list -vH $(USERLAND_REQUIRED_PACKAGES:%=/%) $(REQUIRED_PACKAGES:%=/%) >/dev/null || \ + { echo "Adding required packages to build environment..."; \ + RETVAL=7 ; \ + while [ $$RETVAL -eq 7 ] ; do \ + $(PFEXEC) /usr/bin/pkg install --accept -v $(REQUIRED_PACKAGES:%=/%) ; \ + RETVAL=$$? ; \ + if [ $$RETVAL -eq 4 ] || [ -z $$RETVAL ]; then break; fi; \ + sleep 10; \ + done; } +ZONENAME_PREFIX = bz +ZONENAME_ID = $(shell echo "$(WS_TOP)" | sha1sum | cut -c0-7)-$(COMPONENT_NAME) +ZONENAME = $(ZONENAME_PREFIX)-$(ZONENAME_ID) + +component-zone-template: + $(call separator-line) + $(call separator-line,Create template zone) + USER_ID=$$(id -u) && \ + $(PFEXEC) $(ZONE) --prefix $(ZONENAME_PREFIX) create-template -u $${USER} -i $${USER_ID} + +component-zone-build: + $(call separator-line) + $(call separator-line,Create $(ZONENAME)) + $(PFEXEC) $(ZONE) --prefix $(ZONENAME_PREFIX) spawn-zone --id $(ZONENAME_ID) + $(call separator-line,Boot $(ZONENAME)) + @while $$(true); do \ + echo "Waiting for zone $(ZONENAME) to boot..."; \ + $(PFEXEC) /usr/sbin/zlogin -l $${USER} $(ZONENAME) \ + /bin/true >/dev/null 2>&1 && break; \ + sleep 10; \ + done + # FIXME: + # - remove once we figure out a better way how to enable zoneproxy-client inside the nlipkg brand + @while $$(true); do \ + echo "Waiting for $(ZONENAME) config repository.."; \ + $(PFEXEC) /usr/bin/svcs -z $(ZONENAME) -a >/dev/null 2>&1 && break; \ + sleep 10; \ + done + # We need to create door inside after zone-proxy-client is running + $(call separator-line,Configure IPS for $(ZONENAME)) + $(PFEXEC) /usr/lib/zones/zoneproxy-adm $(ZONENAME) + @while $$(true); do \ + echo "Waiting for zoneproxyd to be ready.."; \ + PROXY_PID=$$(/usr/bin/svcs -p svc:/application/pkg/zones-proxyd:default | \ + nawk '$$0 ~ /zoneproxyd/ {print $$2}') && \ + $(PFEXEC) /usr/bin/pfiles $${PROXY_PID} | \ + $(GNU_GREP) $(ZONENAME) >/dev/null 2>&1 && break; \ + sleep 10; \ + done + $(PFEXEC) /usr/sbin/svcadm -z $(ZONENAME) \ + enable svc:/application/pkg/zones-proxy-client:default + ZONEROOT="$$(/usr/sbin/zoneadm -z $(ZONENAME) list -p | cut -d: -f4)/root" && \ + $(PFEXEC) /usr/bin/pkg -R $${ZONEROOT} set-property use-system-repo True && \ + while $$(true); do \ + echo "Waiting for sysrepo to be ready..." && \ + $(PFEXEC) /usr/bin/pkg -R $${ZONEROOT} publisher | \ + $(GNU_GREP) syspub >/dev/null 2>&1 && break; \ + sleep 10; \ + done + $(call separator-line,Build in $(ZONENAME)) + $(PFEXEC) /usr/sbin/zlogin -l $${USER} $(ZONENAME) \ + "cd $(COMPONENT_DIR); gmake install" + $(call separator-line) + +component-zone-cleanup: + $(PFEXEC) $(ZONE) destroy-zone --id $(ZONENAME_ID) + +# Short aliases for user convenience +env-check:: component-environment-check +env-prep:: component-environment-prep diff --git a/sample_data/make-rules/font.mk b/sample_data/make-rules/font.mk new file mode 100644 index 0000000..df87e7e --- /dev/null +++ b/sample_data/make-rules/font.mk @@ -0,0 +1,201 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2018, Aurelien Larcher. All rights reserved. +# +BUILD_BITS ?= NO_ARCH +BUILD_STYLE ?= archive + +ifneq ($(findstring X11,$(FONT_TYPE)),) +X11_CATEGORY = FONT +include $(WS_MAKE_RULES)/x11.mk +endif + +include $(WS_MAKE_RULES)/common.mk + +MKFONTSCALE = mkfontscale +MKFONTDIR = mkfontdir + +ETCFONTSDIR = $(ETCDIR)/fonts +ETCFONTSCONFDIR = $(ETCFONTSDIR)/conf.avail +USRSHAREFONTSDIR = $(USRSHAREDIR)/fonts + +# +# Font type macros +# + +TTFFONTDIR = TrueType +OTFFONTDIR = OpenType +X11FONTDIR = X11 +X11MISCFONTDIR = X11 +PKGFONTDIR?= $($(FONT_TYPE)FONTDIR) + +# For compatibility +USRSHARETTFFONTSDIR = $(USRSHAREFONTSDIR)/$(TTFFONTDIR) +USRSHAREOTFFONTSDIR = $(USRSHAREFONTSDIR)/$(OTFFONTDIR) +USRSHAREX11FONTSDIR = $(USRSHAREFONTSDIR)/$(X11FONTDIR) + +TTFFONTSRC = ttf +OTFFONTSRC = otf +X11FONTSRC = +X11MISCFONTSRC = +PKGFONTSRC?= $($(FONT_TYPE)FONTSRC) + +TTFFONTCLS = truetype +OTFFONTCLS = opentype +X11FONTCLS = xorg +X11MISCFONTCLS = +PKGFONTCLS?= $($(FONT_TYPE)FONTCLS) + +TTFFONTEXT = *.ttc *.tte *.ttf +OTFFONTEXT = *.otf *.otc *.ttf *.ttc +X11FONTEXT = *.pcf +X11MISCFONTEXT = *.pcf +PKGFONTEXT?= $($(FONT_TYPE)FONTEXT) + +PKGFONTCONFSRC = fontconfig +PKGFONTCONFEXT = *.conf + +# +# Proto area directories +# + +PROTOFONTSDIR = $(PROTO_DIR)$(USRSHAREFONTSDIR) +PROTOTTFFONTSDIR = $(PROTOFONTSDIR)/$(TTFFONTDIR) +PROTOOTFFONTSDIR = $(PROTOFONTSDIR)/$(OTFFONTDIR) +PROTOX11FONTSDIR = $(PROTOFONTSDIR)/$(X11FONTDIR) +PROTOPKGFONTSDIR = $(PROTO$(FONT_TYPE)FONTSDIR) + +PROTOFONTSCONFDIR = $(PROTO_DIR)$(ETCFONTSCONFDIR) + +# +# Default macros +# + +COMPONENT_FONT_TYPE = $(PKGFONTCLS) +COMPONENT_FONT_NAME = $(COMPONENT_NAME) +COMPONENT_FONT_PKG = $(COMPONENT_NAME) +ifeq ($(strip $(COMPONENT_FONT_TYPE)),) +COMPONENT_FMRI = \ + system/font/$(strip $(COMPONENT_FONT_PKG)) +else +COMPONENT_FMRI = \ + system/font/$(strip $(COMPONENT_FONT_TYPE))/$(strip $(COMPONENT_FONT_PKG)) +endif +COMPONENT_CLASSIFICATION = System/Fonts +COMPONENT_CATEGORY = font + +COMPONENT_FONT_DEST_DIR?= $(USRSHAREFONTSDIR)/$(PKGFONTDIR)/$(COMPONENT_FONT_NAME) +COMPONENT_FONT_SRC_DIR ?= $(PKGFONTSRC) +COMPONENT_FONT_FILES = + +COMPONENT_FONTCONF_DEST_DIR?= $(ETCFONTSCONFDIR) +COMPONENT_FONTCONF_SRC_DIR ?= $(PKGFONTCONFSRC) +COMPONENT_FONTCONF_FILES = $(PKGFONTCONFEXT) + +# +# Build style specific rules +# + +ifeq ($(strip $(BUILD_STYLE)),archive) + +POST_INSTALL_MKFONT?=no + +COMPONENT_BUILD_ACTION?= true +ifeq ($(strip $(POST_INSTALL_MKFONT)),no) +COMPONENT_BUILD_ACTION = \ + cd $(@D)/$(COMPONENT_FONT_SRC_DIR); $(MKFONTSCALE); $(MKFONTDIR); +endif + +$(BUILD_DIR)/%/.built: $(SOURCE_DIR)/.prep + ($(RM) -rf $(@D) ; $(MKDIR) $(@D)) + $(CLONEY) $(SOURCE_DIR) $(@D) + $(COMPONENT_PRE_BUILD_ACTION) + ($(COMPONENT_BUILD_ACTION)) + $(COMPONENT_POST_BUILD_ACTION) + $(TOUCH) $@ + +build: $(BUILD_$(MK_BITS)) + +COMPONENT_FONT_POST_INSTALL_ACTION = \ + ( $(MKFONTSCALE) $(PROTO_DIR)$(COMPONENT_FONT_DEST_DIR); \ + $(MKFONTDIR) $(PROTO_DIR)$(COMPONENT_FONT_DEST_DIR) ) + +ifeq ($(strip $(POST_INSTALL_MKFONT)),yes) +COMPONENT_POST_INSTALL_ACTION+=$(COMPONENT_FONT_POST_INSTALL_ACTION) +else +COMPONENT_FONT_FILES += fonts.dir +COMPONENT_FONT_FILES += fonts.scale +endif + +COMPONENT_INSTALL_ACTION = \ + cd $(@D)/$(COMPONENT_FONT_SRC_DIR) && \ + $(INSTALL) -m 0444 $(COMPONENT_FONT_FILES) \ + $(PROTO_DIR)$(COMPONENT_FONT_DEST_DIR) ; \ + if [ -n "$(strip $(COMPONENT_FONTCONF_FILES))" ]; \ + then \ + cd $(@D)/$(COMPONENT_FONTCONF_SRC_DIR) && \ + $(INSTALL) -m 0444 $(COMPONENT_FONTCONF_FILES) \ + $(PROTO_DIR)$(COMPONENT_FONTCONF_DEST_DIR) ; \ + fi; + +$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built + $(MKDIR) $(@D) + $(COMPONENT_PRE_INSTALL_ACTION) + -$(RM) -r $(PROTO_DIR)$(COMPONENT_FONT_DEST_DIR) + $(MKDIR) $(PROTO_DIR)$(COMPONENT_FONT_DEST_DIR) + $(MKDIR) $(PROTO_DIR)$(COMPONENT_FONTCONF_DEST_DIR) + ($(COMPONENT_INSTALL_ACTION)) + $(COMPONENT_POST_INSTALL_ACTION) + $(TOUCH) $@ + +install: $(INSTALL_$(MK_BITS)) + +clean:: + $(RM) -r $(BUILD_DIR) $(PROTO_DIR) + +endif + +ifeq ($(strip $(BUILD_STYLE)),configure) +# We don't compress individual font files so that we get better compression +# at higher levels in ZFS & IPS, and so that we aren't constantly replacing +# font files in every build just because the timestamp in the compressed +# version changed. +CONFIGURE_OPTIONS += --without-compression +endif + +# Add font metadata to packages to make it easier to search for fonts +$(CANONICAL_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.mogrified): PUBLISH_TRANSFORMS += $(@:.mogrified=.font-transforms) + +$(CANONICAL_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.mogrified): font-transforms +font-transforms: $(CANONICAL_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.font-transforms) + +$(MANIFEST_BASE)-%.font-transforms: %.p5m + $(PERL) $(WS_TOOLS)/generate_font_metadata.pl \ + -p $(PROTO_DIR) -m $< > $@ || ( rm $@ ; exit 1 ) + +# Package containing fc-scan used in generate_font_metadata.pl +REQUIRED_PACKAGES += system/library/fontconfig +# Package containing $(MKFONTSCALE) & $(MKFONTDIR) +REQUIRED_PACKAGES += x11/font-utilities + diff --git a/sample_data/make-rules/gcc-component.mk b/sample_data/make-rules/gcc-component.mk new file mode 100644 index 0000000..9b8b76e --- /dev/null +++ b/sample_data/make-rules/gcc-component.mk @@ -0,0 +1,208 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"). You may +# only use this file in accordance with the terms 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 2019 Aurelien Larcher +# + +GCC_COMPONENT_VERSION_MAJOR = $(shell echo $(COMPONENT_VERSION) | $(NAWK) -F. '{print $$1}') + +ifeq ($(strip $(ILLUMOS_GCC_REVISION)),) +GCC_COMPONENT_STRING_VERSION = $(COMPONENT_VERSION)-oi-$(COMPONENT_REVISION) +else +GCC_COMPONENT_STRING_VERSION = $(COMPONENT_VERSION)-il-$(ILLUMOS_GCC_REVISION) +endif + +GCC_COMPONENT_PREFIX = /usr/gcc/$(GCC_COMPONENT_VERSION_MAJOR) + +# +# Define default component variables for upstream GCC +# +ifeq ($(strip $(COMPONENT_VERSION)),) +$(error Empty GCC version) +endif +ifeq ($(strip $(COMPONENT_ARCHIVE_HASH)),) +$(error Empty GCC archive hash) +endif +COMPONENT_NAME= gcc +COMPONENT_FMRI= developer/gcc-$(GCC_COMPONENT_VERSION_MAJOR) +COMPONENT_SUMMARY= GNU Compiler Collection +COMPONENT_CLASSIFICATION= Development/C +COMPONENT_PROJECT_URL = https://gcc.gnu.org/ +COMPONENT_SRC ?= $(COMPONENT_NAME)-$(COMPONENT_VERSION) +COMPONENT_ARCHIVE ?= $(COMPONENT_SRC).tar.xz +COMPONENT_ARCHIVE_URL ?= \ + https://ftp.gnu.org/gnu/gcc/gcc-$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE) + +PATCH_EACH_ARCHIVE=1 +PATCHDIR_PATCHES = $(shell find $(PATCH_DIR) -type f -name '$(PATCH_PATTERN)' \ + 2>/dev/null | sort) + +MPFR_NAME= mpfr +ifeq ($(strip $(MPFR_VERSION)),) +$(error Empty MPFR version) +endif +ifeq ($(strip $(MPFR_ARCHIVE_HASH)),) +$(error Empty MPFR archive hash) +endif +COMPONENT_SRC_1= $(MPFR_NAME)-$(MPFR_VERSION) +COMPONENT_ARCHIVE_1= $(COMPONENT_SRC_1).tar.bz2 +COMPONENT_ARCHIVE_URL_1= https://www.mpfr.org/$(COMPONENT_SRC_1)/$(COMPONENT_ARCHIVE_1) +COMPONENT_ARCHIVE_HASH_1= $(MPFR_ARCHIVE_HASH) +CLEAN_PATHS += $(COMPONENT_SRC_1) +COMPONENT_POST_UNPACK_ACTION_1 += ( $(RM) -r $(COMPONENT_SRC)/$(MPFR_NAME) && $(CP) -rpP $(COMPONENT_SRC_1) $(COMPONENT_SRC)/$(MPFR_NAME) ) + +MPC_NAME=mpc +ifeq ($(strip $(MPC_VERSION)),) +$(error Empty MPC version) +endif +ifeq ($(strip $(MPC_ARCHIVE_HASH)),) +$(error Empty MPC archive hash) +endif +COMPONENT_SRC_2= $(MPC_NAME)-$(MPC_VERSION) +COMPONENT_ARCHIVE_2= $(COMPONENT_SRC_2).tar.gz +COMPONENT_ARCHIVE_URL_2= https://ftp.gnu.org/gnu/mpc/$(COMPONENT_ARCHIVE_2) +COMPONENT_ARCHIVE_HASH_2= $(MPC_ARCHIVE_HASH) +CLEAN_PATHS += $(COMPONENT_SRC_2) +COMPONENT_POST_UNPACK_ACTION_2 += ( $(RM) -r $(COMPONENT_SRC)/$(MPC_NAME) && $(CP) -rpP $(COMPONENT_SRC_2) $(COMPONENT_SRC)/$(MPC_NAME) ) + +GMP_NAME=gmp +ifeq ($(strip $(GMP_VERSION)),) +$(error Empty GMP version) +endif +ifeq ($(strip $(GMP_ARCHIVE_HASH)),) +$(error Empty GMP archive hash) +endif +COMPONENT_SRC_3= $(GMP_NAME)-$(GMP_VERSION) +COMPONENT_ARCHIVE_3= $(COMPONENT_SRC_3).tar.bz2 +COMPONENT_ARCHIVE_URL_3= https://ftp.gnu.org/gnu/gmp/$(COMPONENT_ARCHIVE_3) +COMPONENT_ARCHIVE_HASH_3= $(GMP_ARCHIVE_HASH) +CLEAN_PATHS += $(COMPONENT_SRC_3) +COMPONENT_POST_UNPACK_ACTION_3 += ( $(RM) -r $(COMPONENT_SRC)/$(GMP_NAME) && $(CP) -rpP $(COMPONENT_SRC_3) $(COMPONENT_SRC)/$(GMP_NAME) ) + +BUILD_STYLE=configure + +include $(WS_MAKE_RULES)/common.mk + +PATH=$(PATH.gnu) + +CC_BITS= +CFLAGS= -O2 +CXXFLAGS= -O2 +FCFLAGS= -O2 + +COMMON_ENV= LD_OPTIONS="-zignore -zcombreloc -i" +COMMON_ENV+= LD_FOR_TARGET=/usr/bin/ld +COMMON_ENV+= LD_FOR_HOST=/usr/bin/ld +COMMON_ENV+= STRIP="/usr/bin/strip -x" +COMMON_ENV+= STRIP_FOR_TARGET="/usr/bin/strip -x" +COMMON_ENV+= LD=/usr/bin/ld + +CONFIGURE_ENV+= $(COMMON_ENV) +COMPONENT_BUILD_ENV+= $(COMMON_ENV) +COMPONENT_INSTALL_ENV+= $(COMMON_ENV) + +CONFIGURE_PREFIX=$(GCC_COMPONENT_PREFIX) + +# General options +CONFIGURE_OPTIONS+= --sbindir=$(CONFIGURE_BINDIR.$(BITS)) +CONFIGURE_OPTIONS+= --libdir=$(CONFIGURE_LIBDIR.$(BITS)) +CONFIGURE_OPTIONS+= --libexecdir=$(CONFIGURE_LIBDIR.$(BITS)) +CONFIGURE_OPTIONS+= --host $(GNU_TRIPLET) +CONFIGURE_OPTIONS+= --build $(GNU_TRIPLET) +CONFIGURE_OPTIONS+= --target $(GNU_TRIPLET) +#CONFIGURE_OPTIONS+= --with-boot-ldflags=-R$(CONFIGURE_PREFIX)/lib +CONFIGURE_OPTIONS+= --with-pkgversion="OpenIndiana $(GCC_COMPONENT_STRING_VERSION)" +CONFIGURE_OPTIONS+= --with-bugurl="https://bugs.openindiana.org" + +# Toolchain options +CONFIGURE_OPTIONS+= --without-gnu-ld +CONFIGURE_OPTIONS+= --with-ld=/usr/bin/ld +CONFIGURE_OPTIONS+= --with-build-time-tools=/usr/gnu/$(GNU_TRIPLET)/bin + +# If the compiler used to build matches the compiler being built, there is no +# need for a 3 stage build. +ifneq ($(shell $(CC) --version | grep $(COMPONENT_VERSION)),) +CONFIGURE_OPTIONS += --disable-bootstrap +else +COMPONENT_BUILD_TARGETS=bootstrap +endif + +# On SPARC systems, use Sun Assembler +CONFIGURE_OPTIONS.sparc+= --without-gnu-as --with-as=/usr/bin/as +CONFIGURE_OPTIONS.i386+= --with-gnu-as --with-as=/usr/bin/gas +CONFIGURE_OPTIONS+= $(CONFIGURE_OPTIONS.$(MACH)) + +# Set path to library install prefix +CONFIGURE_OPTIONS+= LDFLAGS="-R$(CONFIGURE_PREFIX)/lib" + +# Strip the resulting binaries +COMPONENT_INSTALL_TARGETS = install-strip + +COMPONENT_POST_INSTALL_ACTION = \ + $(RM) -r $(PROTO_DIR)$(CONFIGURE_PREFIX)/lib/gcc/$(GNU_TRIPLET)/$(COMPONENT_VERSION)/include-fixed + +unexport SHELLOPTS + +# +# Run the tests and generate a summary report, then output the summary +# report into the results file. Note that list of reported tests is sorted +# to allow parallel test run. +# +# To ensure that all tests that are expected to pass actually +# pass, we have to increase the stacksize limit to at least +# 16MB. Otherwise we'll get spurious failures in the test +# harness (gcc.c-torture/compile/limits-exprparen.c and others). +# With the soft stacksize limit set to 16384 we get reasonably good +# test results. +# +ifeq ($(strip $(MACH)),i386) +COMPONENT_PRE_TEST_ACTION += \ + (cd $(COMPONENT_TEST_DIR) ; \ + ulimit -Ss 16385 ; \ + $(ENV) $(COMPONENT_PRE_TEST_ENV) \ + $(GMAKE) -k -i $(JOBS:%=-j%) check check-target RUNTESTFLAGS="--target_board=unix/-m64\{,-msave-args\}" ; \ + $(FIND) . -name '*.sum' | while read f; do \ + gsed -e '1,/^Running target unix/p' -e 'd' $f > $f.2; \ + gsed -e '/^Running target unix/,/Summary ===$/p' -e 'd' $f | grep '^.*: ' | sort -k 2 >> $f.2; \ + gsed -e '/Summary ===$/,$p' -e 'd' $f >> $f.2; \ + mv $f.2 $f; done; \ + $(GMAKE) mail-report.log) +else +COMPONENT_PRE_TEST_ACTION += \ + (cd $(COMPONENT_TEST_DIR) ; \ + ulimit -Ss 16385 ; \ + $(ENV) $(COMPONENT_PRE_TEST_ENV) \ + $(GMAKE) -k -i $(JOBS:%=-j%) check check-target RUNTESTFLAGS="--target_board=unix/-m64" ; \ + $(FIND) . -name '*.sum' | while read f; do \ + gsed -e '1,/^Running target unix/p' -e 'd' $f > $f.2; \ + gsed -e '/^Running target unix/,/Summary ===$/p' -e 'd' $f | grep '^.*: ' | sort -k 2 >> $f.2; \ + gsed -e '/Summary ===$/,$p' -e 'd' $f >> $f.2; \ + mv $f.2 $f; done; \ + $(GMAKE) mail-report.log) +endif + +COMPONENT_TEST_CMD = $(CAT) +COMPONENT_TEST_TARGETS = mail-report.log + +# Master test results are different between x86 and SPARC. +COMPONENT_TEST_MASTER = \ + $(COMPONENT_TEST_RESULTS_DIR)/results-$(MACH).master + +# Common dependencies +REQUIRED_PACKAGES += SUNWcs +REQUIRED_PACKAGES += system/library +REQUIRED_PACKAGES += system/library/math + +# Required by the test suite +REQUIRED_PACKAGES += developer/test/dejagnu +REQUIRED_PACKAGES += developer/build/autoconf-archive +REQUIRED_PACKAGES += developer/build/autogen +REQUIRED_PACKAGES += system/extended-system-utilities diff --git a/sample_data/make-rules/gem.mk b/sample_data/make-rules/gem.mk new file mode 100644 index 0000000..0b28824 --- /dev/null +++ b/sample_data/make-rules/gem.mk @@ -0,0 +1,107 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. +# +GEM=/usr/ruby/$(RUBY_VERSION)/bin/gem + +VENDOR_GEM_DIR=/usr/ruby/$(RUBY_VERSION)/lib/ruby/vendor_ruby/gems/$(RUBY_LIB_VERSION) + +# Name of the gem spec to use. This will typically be +# .gemspec +GEMSPEC=$(COMPONENT_NAME).gemspec + + +# Some gems projects have to be built using rake +# Allow GEM build/install commands to be overwritten +# to account for possible differences +GEM_BUILD_ACTION=(cd $(@D); $(GEM) build $(GEM_BUILD_ARGS) $(GEMSPEC)) + +# Build install args in a more readable fashion +ifeq ($(firstword $(subst .,$(space),$(RUBY_VERSION))),2) +# gem install 2.x does docs differently. Continue to generate both types +GEM_INSTALL_ARGS += --document rdoc,ri +endif + +GEM_INSTALL_ARGS += -V --local --force +GEM_INSTALL_ARGS += --install-dir $(PROTO_DIR)/$(VENDOR_GEM_DIR) +GEM_INSTALL_ARGS += --bindir $(PROTO_DIR)/$(VENDOR_GEM_DIR)/bin + +# cd into build directory +# gem 2.2.3 uses .gem from the cwd ignoring command line .gem file +# gem 1.8.23.2 uses command line .gem file OR .gem from cwd +GEM_INSTALL_ACTION= (cd $(@D); $(GEM) install $(GEM_INSTALL_ARGS) $(COMPONENT_NAME)) + + +$(BUILD_DIR)/%/.built: $(SOURCE_DIR)/.prep + $(RM) -r $(@D) ; $(MKDIR) $(@D) + $(GTAR) -C $(SOURCE_DIR) -cpf - . | $(GTAR) -C $(@D) -xpf - + $(COMPONENT_PRE_BUILD_ACTION) + # Build the gem and cause the generation of a new gem spec + # file in $(COMPONENT_SRC) + $(GEM_BUILD_ACTION) + $(COMPONENT_POST_BUILD_ACTION) + $(TOUCH) $@ + +$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built + $(COMPONENT_PRE_INSTALL_ACTION) + $(MKDIR) $(PROTO_DIR)/$(GEM_DIR) + # Install the new recreated gem + $(GEM_INSTALL_ACTION) + $(COMPONENT_POST_INSTALL_ACTION) + $(TOUCH) $@ + +COMPONENT_TEST_TARGETS = + +# Test the built source. If the output file shows up in the environment or +# arguments, don't redirect stdout/stderr to it. +$(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built + $(RM) -rf $(COMPONENT_TEST_BUILD_DIR) + $(MKDIR) $(COMPONENT_TEST_BUILD_DIR) + $(COMPONENT_PRE_TEST_ACTION) + -(cd $(COMPONENT_TEST_DIR) ; \ + $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \ + $(COMPONENT_TEST_CMD) \ + $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \ + $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_TEST_ENV)$(COMPONENT_TEST_ARGS)),,&> $(COMPONENT_TEST_OUTPUT)) + $(COMPONENT_POST_TEST_ACTION) + $(COMPONENT_TEST_CREATE_TRANSFORMS) + $(COMPONENT_TEST_PERFORM_TRANSFORM) + $(COMPONENT_TEST_COMPARE) + $(COMPONENT_TEST_CLEANUP) + $(TOUCH) $@ + + +$(BUILD_DIR)/%/.tested: $(COMPONENT_TEST_DEP) + $(COMPONENT_PRE_TEST_ACTION) + (cd $(COMPONENT_TEST_DIR) ; \ + $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \ + $(COMPONENT_TEST_CMD) \ + $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) + $(COMPONENT_POST_TEST_ACTION) + $(COMPONENT_TEST_CLEANUP) + $(TOUCH) $@ + +clean:: + $(RM) -r $(SOURCE_DIR) $(BUILD_DIR) + +USERLAND_REQUIRED_PACKAGES += runtime/ruby diff --git a/sample_data/make-rules/history.mk b/sample_data/make-rules/history.mk new file mode 100644 index 0000000..b774b4d --- /dev/null +++ b/sample_data/make-rules/history.mk @@ -0,0 +1,110 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. +# + +# $(WS_MAKE_RULES)/ips.mk really isn't set up to allow you to bypass all +# the automatic (and lengthy) manifest manipulation that it does, which we +# really don't need to do for these static, uninteresting packages. So we just +# write a simple set of publication rules to get the packages into the repo. + +# For gmake clean to work +COMPONENT_SRC=nonexistent + +PKGSEND = /usr/bin/pkgsend +PKGLINT = /usr/bin/python3.5 /usr/bin/pkglint +PKGMOGRIFY = /usr/bin/pkgmogrify + +GENERATE_HISTORY= $(WS_TOOLS)/generate-history +HISTORY= history + +MANIFEST_BASE = $(BUILD_DIR)/manifest-$(MACH) + +CANONICAL_MANIFESTS = $(filter-out dummy.p5m,$(wildcard *.p5m)) +HISTORICAL_MANIFESTS = $(shell $(NAWK) -v FUNCTION=name -f $(GENERATE_HISTORY) < $(HISTORY)) +ARCH_MANIFESTS = $(wildcard *.p5m.$(MACH)) +GENERATED_ARCH_MANIFESTS = $(ARCH_MANIFESTS:%.p5m.$(MACH)=%.p5m) +CANONICAL_MANIFESTS += $(GENERATED_ARCH_MANIFESTS) + +MOGRIFIED = $(CANONICAL_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.mogrified) +HISTOGRIFIED = $(HISTORICAL_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.histogrified) +PUBLISHED = $(CANONICAL_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.published) +PUBLISHED += $(HISTORICAL_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.published) + +# Rule to generate historical manifests from the $(HISTORY) file. +define history-manifest-rule +$(MANIFEST_BASE)-$(1): $(HISTORY) $(BUILD_DIR) + $(NAWK) -v FUNCTION=manifest -v TARGET=$1 -f $(GENERATE_HISTORY) < \ + $(HISTORY) > $$@ +endef +$(foreach mfst,$(HISTORICAL_MANIFESTS),$(eval $(call history-manifest-rule,$(mfst)))) + +ASLR_MODE = $(ASLR_NOT_APPLICABLE) + +PKG_MACROS = CONSOLIDATION=$(CONSOLIDATION) +PKG_MACROS += BUILD_VERSION=$(BUILD_VERSION) +PKG_MACROS += OS_VERSION=$(OS_VERSION) + +PKG_OPTIONS += $(PKG_MACROS:%=-D %) + +build install test system-test: + @echo "nothing to be done for $@" + +$(BUILD_DIR): + $(MKDIR) $@ + +$(MANIFEST_BASE)-%.mogrified: %.p5m $(BUILD_DIR) + $(PKGMOGRIFY) $(PKG_OPTIONS) $< > $@ + +$(MANIFEST_BASE)-%.histogrified: $(MANIFEST_BASE)-%.p5m $(BUILD_DIR) + $(PKGMOGRIFY) $(PKG_OPTIONS) $< > $@ + +$(MANIFEST_BASE)-%.published: $(MANIFEST_BASE)-%.mogrified $(BUILD_DIR) + $(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest --no-catalog $< + $(CP) $< $@ + +$(MANIFEST_BASE)-%.published: $(MANIFEST_BASE)-%.histogrified $(BUILD_DIR) + $(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest --no-catalog $< + $(CP) $< $@ + +$(BUILD_DIR)/.linted-$(MACH): $(MOGRIFIED) $(HISTOGRIFIED) $(BUILD_DIR) + if [[ -n "$(MOGRIFIED)" ]]; \ + then \ + $(ENV) PYTHONPATH=$(WS_TOOLS)/python \ + SOLARIS_VERSION=$(SOLARIS_VERSION) \ + $(PKGLINT) $(CANONICAL_REPO:%=-c $(WS_LINT_CACHE)) \ + -f $(WS_TOOLS)/pkglintrc $(MOGRIFIED); \ + fi + $(TOUCH) $@ + +$(BUILD_DIR)/.published-$(MACH): $(BUILD_DIR)/.linted-$(MACH) $(PUBLISHED) + $(TOUCH) $@ + +publish: $(BUILD_DIR)/.published-$(MACH) + +print-package-names: + @cat history | cut -f 1 -d '@' + +%.p5m: %.p5m.$(MACH) + $(CP) $< $@ + +clobber clean:: + $(RM) -r $(BUILD_DIR) $(GENERATED_ARCH_MANIFESTS) diff --git a/sample_data/make-rules/install.rb.mk b/sample_data/make-rules/install.rb.mk new file mode 100644 index 0000000..e3fdf78 --- /dev/null +++ b/sample_data/make-rules/install.rb.mk @@ -0,0 +1,50 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. +# + +VENDOR_RUBY = /usr/ruby/$(RUBY_VERSION)/lib/ruby/vendor_ruby/$(RUBY_LIB_VERSION) + +# default user executable binaries to /usr/bin +INSTALL_RB_BINDIR = $(USRBINDIR) + +# install.rb scripts do not have any concept of 'build' so make this a +# no-op +$(BUILD_DIR)/%/.built: $(SOURCE_DIR)/.prep + $(RM) -r $(@D) ; $(MKDIR) $(@D) + $(COMPONENT_PRE_BUILD_ACTION) + $(COMPONENT_POST_BUILD_ACTION) + $(TOUCH) $@ + +# install the source into the proto directory +$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built + $(COMPONENT_PRE_INSTALL_ACTION) + (cd $(SOURCE_DIR) ; $(ENV) $(COMPONENT_INSTALL_ENV) \ + ./install.rb --destdir=$(PROTO_DIR) \ + --ruby=$(RUBY) \ + --bindir=$(INSTALL_RB_BINDIR) \ + --sitelibdir=$(VENDOR_RUBY) \ + --mandir=$(USRSHAREMANDIR)) + $(COMPONENT_POST_INSTALL_ACTION) + $(TOUCH) $@ + +clean:: + $(RM) -r $(SOURCE_DIR) $(BUILD_DIR) diff --git a/sample_data/make-rules/ips-buildinfo.mk b/sample_data/make-rules/ips-buildinfo.mk new file mode 100644 index 0000000..099af35 --- /dev/null +++ b/sample_data/make-rules/ips-buildinfo.mk @@ -0,0 +1,71 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright 2014 Andrzej Szeszo. All rights reserved. +# + + +# The package branch version scheme is: +# +# release_major.release_minor.update.component_revision +# + +# +# Release major number: 2014, 2015, etc. +# +RELEASE_MAJOR ?= 2022 + +# +# Release minor number: 0, 1, 2, etc. +# +RELEASE_MINOR ?= 0 + +# +# Release update number: 0, 1, 2, etc. +# +UPDATENUM ?= 0 + +# +# Component revision. Should be specified in the component's Makefile +# + +COMPONENT_REVISION ?= 0 + +# +# Branch Identifier. Used in the version section of the package name to +# identify the operating system branch that the package was produced for. +# +BRANCHID ?= $(RELEASE_MAJOR).$(RELEASE_MINOR).$(UPDATENUM).$(COMPONENT_REVISION) + +# +# Build Version. Used in the version section of the package name to identify +# the operating system version and branch that the package was produced for. +# +BUILD_VERSION ?= $(PKG_SOLARIS_VERSION)-$(BRANCHID) + +# Set a default reference repository against which pkglint is run, in case it +# hasn't been set in the environment. +#CANONICAL_REPO ?= http://ipkg.us.oracle.com/solaris12/dev/ + +# Pre-set some variables with GIT repo details +USERLAND_GIT_REMOTE ?= $(shell git remote -v | awk '/origin.*fetch/ { print $$2 }') +USERLAND_GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) +USERLAND_GIT_REV ?= $(shell git rev-parse HEAD) diff --git a/sample_data/make-rules/ips.mk b/sample_data/make-rules/ips.mk new file mode 100644 index 0000000..18ba2b8 --- /dev/null +++ b/sample_data/make-rules/ips.mk @@ -0,0 +1,627 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright 2014 Andrzej Szeszo. All rights reserved. +# + +# +# Rules and Macros for generating an IPS package manifest and publishing an +# IPS package to a pkg depot. +# +# To use these rules, include ../make-rules/ips.mk in your Makefile +# and define an "install" target appropriate to building your component. +# Ex: +# +# install: $(BUILD_DIR)/build/$(MACH32)/.installed \ +# $(BUILD_DIR)/build/$(MACH64)/.installed +# +# This set of rules makes the "publish" target the default target for make(1) +# + +PKGDEPEND = /usr/bin/pkgdepend +PKGFMT = /usr/bin/pkgfmt +PKGMOGRIFY = /usr/bin/pkgmogrify +PKGSEND = /usr/bin/pkgsend +ifeq ($(strip $(PKGLINT_COMPONENT)),) +PKGLINT = /usr/bin/python3.5 /usr/bin/pkglint +else +PKGLINT = ${WS_TOOLS}/pkglint +endif +PKGMANGLE = $(WS_TOOLS)/userland-mangler + +WS_TRANSFORMS = $(WS_TOP)/transforms + +GENERATE_HISTORY= $(WS_TOOLS)/generate-history +HISTORY= history + +# Package headers should all pretty much follow the same format +METADATA_TEMPLATE = $(WS_TOP)/transforms/manifest-metadata-template +COPYRIGHT_TEMPLATE = $(WS_TOP)/transforms/copyright-template + +# order is important +GENERATE_TRANSFORMS += $(WS_TOP)/transforms/generate-cleanup + +PKGMOGRIFY_TRANSFORMS += $(WS_TOP)/transforms/libtool-drop +PKGMOGRIFY_TRANSFORMS += $(WS_TOP)/transforms/ignore-libs + +ifneq ($(GCC_ROOT), /usr/gcc/4.9) +PKGMOGRIFY_TRANSFORMS += $(WS_TOP)/transforms/ignore-gcc-usr-lib +endif + +COMPARISON_TRANSFORMS += $(WS_TOP)/transforms/comparison-cleanup +COMPARISON_TRANSFORMS += $(PKGMOGRIFY_TRANSFORMS) + +LICENSE_TRANSFORMS = $(WS_TOP)/transforms/license-changes + +# order is important +PUBLISH_TRANSFORMS += $(LICENSE_TRANSFORMS) +PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/variant-cleanup +PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/autopyc +PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/defaults +PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/actuators +PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/devel +PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/docs +PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/locale +PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/python-3-soabi +PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/python-3-no-32bit +PUBLISH_TRANSFORMS += $(PKGMOGRIFY_TRANSFORMS) +PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/publish-cleanup + +FINAL_TRANSFORMS += $(WS_TOP)/transforms/final-cleanup + +define add-limiting-variable +PKG_VARS += $(1) +MANIFEST_LIMITING_VARS += -D $(1)="$(subst #,\#,$($(1)))" +endef + +# Make all the limiting variables available to manifest processing +$(foreach var, $(filter PY3_%_NAMING,$(.VARIABLES)), \ + $(eval $(call add-limiting-variable,$(var)))) + + +ifeq ($(strip $(COMPONENT_AUTOGEN_MANIFEST)),yes) +AUTOGEN_MANIFEST_TRANSFORMS += $(WS_TOP)/transforms/generate-cleanup +else +AUTOGEN_MANIFEST_TRANSFORMS += $(WS_TOP)/transforms/drop-all +endif + +# For items defined as variables or that may contain whitespace, add +# them to a list to be expanded into PKG_OPTIONS later. +PKG_VARS += ARC_CASE TPNO +PKG_VARS += MACH MACH32 MACH64 +PKG_VARS += BUILD_VERSION OS_VERSION PKG_SOLARIS_VERSION +PKG_VARS += GNU_TRIPLET +PKG_VARS += CONSOLIDATION +PKG_VARS += COMPONENT_VERSION IPS_COMPONENT_VERSION HUMAN_VERSION +PKG_VARS += COMPONENT_ARCHIVE_URL COMPONENT_PROJECT_URL COMPONENT_NAME +PKG_VARS += COMPONENT_FMRI COMPONENT_LICENSE_FILE +PKG_VARS += COMPONENT_SUMMARY COMPONENT_DESCRIPTION COMPONENT_LICENSE +PKG_VARS += HG_REPO HG_REV HG_URL COMPONENT_HG_URL COMPONENT_HG_REV +PKG_VARS += GIT_COMMIT_ID GIT_REPO GIT_TAG +PKG_VARS += PUBLISHER PUBLISHER_LOCALIZABLE +PKG_VARS += USERLAND_GIT_REMOTE USERLAND_GIT_BRANCH USERLAND_GIT_REV + +# For items that need special definition, add them to PKG_MACROS. +# IPS_COMPONENT_VERSION suitable for use in regular expressions. +PKG_MACROS += IPS_COMPONENT_RE_VERSION=$(subst .,\\.,$(IPS_COMPONENT_VERSION)) +# COMPONENT_VERSION suitable for use in regular expressions. +PKG_MACROS += COMPONENT_RE_VERSION=$(subst .,\\.,$(COMPONENT_VERSION)) + +PKG_OPTIONS += $(PKG_MACROS:%=-D %) \ + -D COMPONENT_CLASSIFICATION="org.opensolaris.category.2008:$(strip $(COMPONENT_CLASSIFICATION))" + +define mach-list-generate-macros +ifeq ($(MACH),$(1)) +PKG_MACROS += $(1)_ONLY= +PKG_MACROS += $(1)_EXCL=\# +else +PKG_MACROS += $(1)_ONLY=\# +PKG_MACROS += $(1)_EXCL= +endif +endef +$(foreach isa,$(MACH_LIST),$(eval $(call mach-list-generate-macros,$(isa)))) + +define python-generate-macros +PKG_MACROS += PYTHON_$(1)_ONLY=\# +PKG_MACROS += PYTHON_$(1)_EXCL= +endef +$(foreach ver,$(PYTHON_VERSIONS),$(eval $(call python-generate-macros,$(ver)))) + +PKG_MACROS += PYTHON_32_ONLY= + +MANGLED_DIR = $(PROTO_DIR)/mangled + +PKG_PROTO_DIRS += $(MANGLED_DIR) $(PROTO_DIR) $(@D) $(COMPONENT_DIR) $(COMPONENT_SRC) + +MANIFEST_BASE = $(BUILD_DIR)/manifest-$(MACH) + +SAMPLE_MANIFEST_DIR = $(COMPONENT_DIR)/manifests +SAMPLE_MANIFEST_FILE = $(SAMPLE_MANIFEST_DIR)/sample-manifest.p5m +GENERIC_MANIFEST_FILE = $(SAMPLE_MANIFEST_DIR)/generic-manifest.p5m + +CANONICAL_MANIFESTS = $(wildcard *.p5m) +ifneq ($(wildcard $(HISTORY)),) +HISTORICAL_MANIFESTS = $(shell $(NAWK) -v FUNCTION=name -f $(GENERATE_HISTORY) < $(HISTORY)) +endif + +define ips-print-depend-require-rule +$(shell cat $(1) $(WS_TOP)/transforms/print-depend-require |\ + $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 |\ + sed -e '/^$$/d' -e '/^#.*$$/d' | sort -u) +endef + +define ips-print-depend-require-versioned-rule +$(foreach v,$($(1)V_VALUES),\ + $(shell cat $(2) $(WS_TOP)/transforms/print-pkgs |\ + $(PKGMOGRIFY) $(PKG_OPTIONS) -D $($(1)V_FMRI_VERSION)=$(v) /dev/fd/0 |\ + sed -e '/^$$/d' -e '/^#.*$$/d' | sort -u)) +endef + +define ips-print-depend-require-type-rule +$(foreach m,$($(1)_MANIFESTS),$(call ips-print-depend-require-versioned-rule,$(1),$(m))) +endef + +define ips-print-names-rule +$(shell cat $(1) $(WS_TOP)/transforms/print-pkgs |\ + $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 |\ + sed -e '/^$$/d' -e '/^#.*$$/d' | LANG=C LC_ALL=C sort -u) +endef + +define ips-print-names-versioned-rule +$(foreach v,$($(1)V_VALUES),\ + $(shell cat $(2) $(WS_TOP)/transforms/print-pkgs |\ + $(PKGMOGRIFY) $(PKG_OPTIONS) -D $($(1)V_FMRI_VERSION)=$(v) /dev/fd/0 |\ + sed -e '/^$$/d' -e '/^#.*$$/d' | LANG=C LC_ALL=C sort -u)) +endef + +# +# In addition to the concrete per-version packages, we also need to emit the +# name of the generic package which pulls in the concrete packages. +# +define ips-print-names-generic-rule +$(shell cat $(2) $(WS_TOP)/transforms/mkgeneric $(BUILD_DIR)/mkgeneric-python \ + $(WS_TOP)/transforms/print-pkgs |\ + $(PKGMOGRIFY) $(PKG_OPTIONS) -D $($(1)V_FMRI_VERSION)=\#\#\# /dev/fd/0 |\ + sed -e '/^$$/d' -e '/^#.*$$/d' | LANG=C LC_ALL=C sort -u) +endef + +define ips-print-names-type-rule +$(foreach m,$($(1)_MANIFESTS),\ + $(call ips-print-names-versioned-rule,$(1),$(m))\ + $(call ips-print-names-generic-rule,$(1),$(m))\ +) +endef + +VERSIONED_MANIFEST_TYPES = +UNVERSIONED_MANIFESTS = $(filter-out %-GENFRAG.p5m, $(CANONICAL_MANIFESTS)) +GENERATE_GENERIC_TRANSFORMS= + +# Look for manifests which need to be duplicated for each version of python. +ifeq ($(findstring -PYVER,$(CANONICAL_MANIFESTS)),-PYVER) +VERSIONED_MANIFEST_TYPES+= PY +NOPY_MANIFESTS = $(filter-out %-PYVER.p5m,$(UNVERSIONED_MANIFESTS)) +PY_MANIFESTS = $(filter %-PYVER.p5m,$(CANONICAL_MANIFESTS)) +PYV_VALUES = $(shell echo $(PYTHON_VERSIONS) | tr -d .) +PYV_FMRI_VERSION = PYV +PYV_MANIFESTS = $(foreach v,$(PYV_VALUES),$(shell echo $(PY_MANIFESTS) | sed -e 's/-PYVER.p5m/-$(v).p5m/g')) +PYNV_MANIFESTS = $(shell echo $(PY_MANIFESTS) | sed -e 's/-PYVER//') +MKGENERIC_SCRIPTS += $(BUILD_DIR)/mkgeneric-python +GENERATE_GENERIC_TRANSFORMS+=$(PYTHON_VERSIONS:%=-e 's/%/\$$\(PYVER\)/g') +else +NOPY_MANIFESTS = $(UNVERSIONED_MANIFESTS) +endif + +# Look for manifests which need to be duplicated for each version of perl. +ifeq ($(findstring -PERLVER,$(UNVERSIONED_MANIFESTS)),-PERLVER) +VERSIONED_MANIFEST_TYPES+= PERL +NOPERL_MANIFESTS = $(filter-out %-PERLVER.p5m,$(NOPY_MANIFESTS)) +PERL_MANIFESTS = $(filter %-PERLVER.p5m,$(UNVERSIONED_MANIFESTS)) +PERLV_VALUES = $(shell echo $(PERL_VERSIONS) | tr -d .) +PERLV_FMRI_VERSION = PLV +PERLV_MANIFESTS = $(foreach v,$(PERLV_VALUES),$(shell echo $(PERL_MANIFESTS) | sed -e 's/-PERLVER.p5m/-$(v).p5m/g')) +PERLNV_MANIFESTS = $(shell echo $(PERL_MANIFESTS) | sed -e 's/-PERLVER//') +else +NOPERL_MANIFESTS = $(NOPY_MANIFESTS) +endif + +# Look for manifests which need to be duplicated for each version of ruby. +# NOPERL_MANIFESTS represents the manifests that are not Python or +# Perl manifests. Extract the Ruby Manifests from NOPERL_MANIFESTS. +# Any remaining manifests are stored in NONRUBY_MANIFESTS +ifeq ($(findstring -RUBYVER,$(NOPERL_MANIFESTS)),-RUBYVER) +VERSIONED_MANIFEST_TYPES+= RUBY +NORUBY_MANIFESTS = $(filter-out %-RUBYVER.p5m,$(NOPERL_MANIFESTS)) +RUBY_MANIFESTS = $(filter %-RUBYVER.p5m,$(NOPERL_MANIFESTS)) +RUBYV_VALUES = $(RUBY_VERSIONS) +RUBYV_FMRI_VERSION = RUBYV +RUBYV_MANIFESTS = $(foreach v,$(RUBY_VERSIONS),\ + $(shell echo $(RUBY_MANIFESTS) |\ + sed -e 's/-RUBYVER.p5m/-$(shell echo $(v) |\ + cut -d. -f1,2 | tr -d .).p5m/g')) +RUBYNV_MANIFESTS = $(shell echo $(RUBY_MANIFESTS) | sed -e 's/-RUBYVER//') +else +NORUBY_MANIFESTS = $(NOPERL_MANIFESTS) +endif + +NONVER_MANIFESTS = $(NORUBY_MANIFESTS) + +VERSIONED_MANIFESTS = \ + $(PYV_MANIFESTS) $(PYNV_MANIFESTS) \ + $(PERLV_MANIFESTS) $(PERLNV_MANIFESTS) \ + $(RUBYV_MANIFESTS) $(RUBYNV_MANIFESTS) \ + $(NORUBY_MANIFESTS) $(HISTORICAL_MANIFESTS) + +GENERATED = $(MANIFEST_BASE)-generated +COMBINED = $(MANIFEST_BASE)-combined +MANIFESTS = $(VERSIONED_MANIFESTS:%=$(MANIFEST_BASE)-%) + + +DEPENDED=$(VERSIONED_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.depend) +RESOLVED=$(VERSIONED_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.depend.res) +PRE_PUBLISHED=$(RESOLVED:%.depend.res=%.pre-published) +PUBLISHED=$(RESOLVED:%.depend.res=%.published) + +COPYRIGHT_FILE ?= $(COMPONENT_NAME)-$(COMPONENT_VERSION).copyright +IPS_COMPONENT_VERSION ?= $(COMPONENT_VERSION) + +.DEFAULT: publish + +.SECONDARY: + +# allow publishing to be overridden, such as when +# a package is for one architecture only. +PRE_PUBLISH_STAMP ?= $(BUILD_DIR)/.pre-published-$(MACH) +PUBLISH_STAMP ?= $(BUILD_DIR)/.published-$(MACH) + +# Do all that is needed to ensure the package is consistent for publishing, +# except actually pushing to a repo, separately from the push to the repo. +pre-publish: build install $(PRE_PUBLISH_STAMP) +publish: pre-publish update-metadata $(PUBLISH_STAMP) + +sample-manifest: $(GENERATED).p5m + +$(GENERATED).p5m: install + [ ! -d $(SAMPLE_MANIFEST_DIR) ] && $(MKDIR) $(SAMPLE_MANIFEST_DIR) || true + $(PKGSEND) generate $(PKG_HARDLINKS:%=--target %) $(PROTO_DIR) | \ + $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 $(GENERATE_TRANSFORMS) | \ + sed -e '/^$$/d' -e '/^#.*$$/d' \ + -e '/\.la$$/d' -e '/\.pyo$$/d' -e '/usr\/lib\/python[23]\..*\.pyc$$/d' \ + -e '/usr\/lib\/python3\..*\/__pycache__\/.*/d' | \ + $(PKGFMT) | \ + cat $(METADATA_TEMPLATE) - | \ + $(TEE) $@ $(SAMPLE_MANIFEST_FILE) >/dev/null + if [ "$(GENERATE_GENERIC_TRANSFORMS)X" != "X" ]; \ + then sed $(GENERATE_GENERIC_TRANSFORMS) $(SAMPLE_MANIFEST_FILE) \ + | gawk '!seen[$$0]++' > $(GENERIC_MANIFEST_FILE); fi; + +# copy the canonical manifest(s) to the build tree +$(MANIFEST_BASE)-%.generate: %.p5m canonical-manifests + cat $(METADATA_TEMPLATE) $< >$@ + +# The text of a transform that will emit a dependency conditional on the +# presence of a particular version of a runtime, which will then draw in the +# runtime-version-specific version of the package we're operating on. $(1) is +# the name of the runtime package, and $(2) is the version suffix. +mkgeneric = \ + echo " emit depend nodrop=true type=conditional" \ + "predicate=$(1)-$(2) fmri=%<1>-$(2)@%<2>>" >> $@; + +mkgenericdep = \ + ( echo -n " emit depend nodrop=true type=require-any " ; \ + for i in $(2); do echo -n "fmri=%<1>-$$i@%<2> " ; done ; \ + echo ">" ) >> $@ + +# Define and execute a macro that generates a rule to create a manifest for a +# python module specific to a particular version of the python runtime. +define python-manifest-rule +$(MANIFEST_BASE)-%-$(2).mogrified: PKG_MACROS += PYTHON_$(1)_ONLY= PYTHON_$(1)_EXCL=\# + +ifneq ($(filter $(1),$(PYTHON_64_ONLY_VERSIONS)),) +$(MANIFEST_BASE)-%-$(2).mogrified: PKG_MACROS += PYTHON_32_ONLY=\# +endif + +$(MANIFEST_BASE)-%-$(2).p5m: %-PYVER.p5m + $(PKGMOGRIFY) -D PYVER=$(1) $(MANIFEST_LIMITING_VARS) -D PYV=$(2) $$< > $$@ +endef +$(foreach ver,$(PYTHON_VERSIONS),$(eval $(call python-manifest-rule,$(ver),$(shell echo $(ver)|tr -d .)))) + +# A rule to create a helper transform package for python, that will insert the +# appropriate conditional dependencies into a python library's +# runtime-version-generic package to pull in the version-specific bits when the +# corresponding version of python is on the system. +$(BUILD_DIR)/mkgeneric-python: $(WS_TOP)/make-rules/shared-macros.mk $(MAKEFILE_PREREQ) $(BUILD_DIR) + $(RM) $@ + $(foreach ver,$(shell echo $(PYTHON_VERSIONS) | tr -d .), \ + $(call mkgeneric,runtime/python,$(ver))) + $(call mkgenericdep,runtime/python,$(shell echo $(PYTHON_VERSIONS) | tr -d .)) + +# Build Python version-wrapping manifests from the generic version. +$(MANIFEST_BASE)-%.p5m: %-PYVER.p5m $(BUILD_DIR)/mkgeneric-python + $(PKGMOGRIFY) -D PYV=### $(BUILD_DIR)/mkgeneric-python \ + $(WS_TOP)/transforms/mkgeneric $< > $@ + if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi + +# Define and execute a macro that generates a rule to create a manifest for a +# perl module specific to a particular version of the perl runtime. +define perl-manifest-rule +$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-PERLVER.p5m + $(PKGMOGRIFY) -D PERLVER=$(1) -D PLV=$(shell echo $(1) | tr -d .) \ + -D PERL_ARCH=$(call PERL_ARCH_FUNC,$(PERL.$(1))) $$< > $$@ +endef +$(foreach ver,$(PERL_VERSIONS),$(eval $(call perl-manifest-rule,$(ver)))) + +# A rule to create a helper transform package for perl, that will insert the +# appropriate conditional dependencies into a perl library's +# runtime-version-generic package to pull in the version-specific bits when the +# corresponding version of perl is on the system. +$(BUILD_DIR)/mkgeneric-perl: $(WS_TOP)/make-rules/shared-macros.mk $(MAKEFILE_PREREQ) + $(RM) $@ + $(foreach ver,$(shell echo $(PERL_VERSIONS) | tr -d .), \ + $(call mkgeneric,runtime/perl,$(ver))) + $(call mkgenericdep,runtime/perl,$(shell echo $(PERL_VERSIONS) | tr -d .)) + +# Build Perl version-wrapping manifests from the generic version. +$(MANIFEST_BASE)-%.p5m: %-PERLVER.p5m $(BUILD_DIR)/mkgeneric-perl + $(PKGMOGRIFY) -D PLV=### $(BUILD_DIR)/mkgeneric-perl \ + $(WS_TOP)/transforms/mkgeneric $< > $@ + if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi + +# Rule to generate historical manifests from the $(HISTORY) file. +define history-manifest-rule +$(MANIFEST_BASE)-$(1): $(HISTORY) $(BUILD_DIR) + $(NAWK) -v TARGET=$(1) -v FUNCTION=manifest -f $(GENERATE_HISTORY) < \ + $(HISTORY) > $$@ +endef +$(foreach mfst,$(HISTORICAL_MANIFESTS),$(eval $(call history-manifest-rule,$(mfst)))) + +# Define and execute a macro that generates a rule to create a manifest for a +# ruby module specific to a particular version of the ruby runtime. +# Creates build/manifest-*-modulename-##.p5m file where ## is replaced with +# the version number. +define ruby-manifest-rule +$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).mogrified: \ + PKG_MACROS += RUBY_VERSION=$(1) RUBY_LIB_VERSION=$(2) \ + RUBYV=$(subst .,,$(1)) + +$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-RUBYVER.p5m + if [ -f $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m ]; then \ + cat $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m >> $$@; \ + fi + $(PKGMOGRIFY) -D RUBY_VERSION=$(1) -D RUBY_LIB_VERSION=$(2) \ + -D RUBYV=$(shell echo $(1) | tr -d .) $$< > $$@ +endef +$(foreach ver,$(RUBY_VERSIONS),\ + $(eval $(call ruby-manifest-rule,$(shell echo $(ver) | \ + cut -d. -f1,2),$(ver)))) + +# A rule to create a helper transform package for ruby, that will insert the +# appropriate conditional dependencies into a ruby library's +# runtime-version-generic package to pull in the version-specific bits when the +# corresponding version of ruby is on the system. +$(BUILD_DIR)/mkgeneric-ruby: $(WS_TOP)/make-rules/shared-macros.mk $(MAKEFILE_PREREQ) + $(RM) $@ + $(foreach ver,$(RUBY_VERSIONS),\ + $(call mkgeneric,runtime/ruby,$(shell echo $(ver) | \ + cut -d. -f1,2 | tr -d .))) + $(call mkgenericdep,runtime/ruby,$(shell echo $(RUBY_VERSIONS) | cut -d. -f1,2 | tr -d .)) + +# Build Ruby version-wrapping manifests from the generic version. +# Creates build/manifest-*-modulename.p5m file. +# +$(MANIFEST_BASE)-%.p5m: %-RUBYVER.p5m $(BUILD_DIR)/mkgeneric-ruby + $(PKGMOGRIFY) -D RUBYV=### $(BUILD_DIR)/mkgeneric-ruby \ + $(WS_TOP)/transforms/mkgeneric $< > $@ + if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi + +ifeq ($(strip $(COMPONENT_AUTOGEN_MANIFEST)),yes) +# auto-generate file/directory list +$(MANIFEST_BASE)-%.generated: %.p5m $(BUILD_DIR) + (cat $(METADATA_TEMPLATE); \ + $(PKGSEND) generate $(PKG_HARDLINKS:%=--target %) $(PROTO_DIR)) | \ + $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 $(AUTOGEN_MANIFEST_TRANSFORMS) | \ + sed -e '/^$$/d' -e '/^#.*$$/d' | $(PKGFMT) | \ + cat $< - >$@ + +# mogrify non-parameterized manifests +$(MANIFEST_BASE)-%.mogrified: %.generated + $(PKGMOGRIFY) $(PKG_OPTIONS) $< \ + $(PUBLISH_TRANSFORMS) | \ + sed -e '/^$$/d' -e '/^#.*$$/d' | uniq >$@ + +# mogrify parameterized manifests +$(MANIFEST_BASE)-%.mogrified: $(MANIFEST_BASE)-%.generated + $(PKGMOGRIFY) $(PKG_OPTIONS) $< \ + $(PUBLISH_TRANSFORMS) | \ + sed -e '/^$$/d' -e '/^#.*$$/d' | uniq >$@ +else +# mogrify non-parameterized manifests +$(MANIFEST_BASE)-%.mogrified: %.p5m $(BUILD_DIR) + $(PKGMOGRIFY) $(PKG_OPTIONS) $< \ + $(PUBLISH_TRANSFORMS) | \ + sed -e '/^$$/d' -e '/^#.*$$/d' | uniq >$@ + +# mogrify parameterized manifests +$(MANIFEST_BASE)-%.mogrified: $(MANIFEST_BASE)-%.p5m $(BUILD_DIR) + $(PKGMOGRIFY) $(PKG_OPTIONS) $< \ + $(PUBLISH_TRANSFORMS) | \ + sed -e '/^$$/d' -e '/^#.*$$/d' | uniq >$@ +endif + +# mangle the file contents +$(BUILD_DIR) $(MANGLED_DIR): + $(MKDIR) $@ + +PKGMANGLE_OPTIONS = -D $(MANGLED_DIR) $(PKG_PROTO_DIRS:%=-d %) +$(MANIFEST_BASE)-%.mangled: $(MANIFEST_BASE)-%.mogrified $(MANGLED_DIR) + $(PKGMANGLE) $(PKGMANGLE_OPTIONS) -m $< >$@ + +# generate dependencies +PKGDEPEND_GENERATE_OPTIONS = -m $(PKG_PROTO_DIRS:%=-d %) +$(MANIFEST_BASE)-%.depend: $(MANIFEST_BASE)-%.mangled + $(PKGDEPEND) generate $(PKGDEPEND_GENERATE_OPTIONS) $< >$@ + +# pkgdepend resolve builds a map of all installed packages by default. This +# makes dependency resolution particularly slow. We can dramatically improve +# performance here by creating a file with a list of packages that we know +# are needed, dramatically reducing the overhead involved in creating and +# searching this map. +# +# Generate a resolve.deps file from the dependencies in the Makefile and +# fragments that it uses. +RESOLVE_DEPS=$(BUILD_DIR)/resolve.deps + +$(RESOLVE_DEPS): Makefile $(BUILD_DIR) $(DEPENDED) + @(for pkg in $(REQUIRED_PACKAGES:%=/%) ; do \ + echo $${pkg} ; \ + done ; \ + $(PKGMOGRIFY) $(WS_TRANSFORMS)/PRINT_COMPONENT_FMRIS $(DEPENDED) | \ + $(GSED) -e '/^[\t ]*$$/d' -e '/^#/d' ;) | sort -u >$@ + +# resolve the dependencies all at once +$(BUILD_DIR)/.resolved-$(MACH): $(DEPENDED) $(RESOLVE_DEPS) + $(PKGDEPEND) resolve $(RESOLVE_DEPS:%=-e %) -m $(DEPENDED) + $(TOUCH) $@ + +# Set REQUIRED_PACKAGES macro substitution rules +REQUIRED_PACKAGES_TRANSFORM=$(foreach p,$(REQUIRED_PACKAGES_SUBST), -e 's|$($(p))|$$($(p))|') + +# +# Generate a set of REQUIRED_PACKAGES based on what is needed for pkgdepend to +# resolve properly. Automatically update the list in your Makefile for the +# truly lazy among us. This is only a piece of the REQUIRED_PACKAGES puzzle. +# You must still include packages for tools you build and test with. +# +REQUIRED_PACKAGES:: $(RESOLVED) + $(GMAKE) RESOLVE_DEPS= $(BUILD_DIR)/.resolved-$(MACH) + @$(GSED) -i -e '/^# Auto-generated dependencies$$/,$$d' Makefile + @echo "# Auto-generated dependencies" >>Makefile + @$(PKGMOGRIFY) $(WS_TRANSFORMS)/$@ $(RESOLVED) | \ + $(GSED) -e '/^[\t ]*$$/d' -e '/^#/d' $(REQUIRED_PACKAGES_TRANSFORM) \ + | sort -u >>Makefile + @echo "*** Please edit your Makefile and verify the new or updated content at the end ***" + + +# lint the manifests all at once +$(BUILD_DIR)/.linted-$(MACH): $(BUILD_DIR)/.resolved-$(MACH) + @echo "VALIDATING MANIFEST CONTENT: $(RESOLVED)" + $(ENV) PYTHONPATH=$(WS_TOOLS)/python PROTO_PATH="$(PKG_PROTO_DIRS)" $(COMPONENT_PKGLINT_ENV)\ + $(PKGLINT) $(CANONICAL_REPO:%=-c $(WS_LINT_CACHE)) \ + -f $(WS_TOOLS)/pkglintrc $(RESOLVED) + $(TOUCH) $@ + +lintme: FRC + @echo "VALIDATING MANIFEST CONTENT: $(RESOLVED)" + $(ENV) PYTHONPATH=$(WS_TOOLS)/python PROTO_PATH="$(PKG_PROTO_DIRS)" $(COMPONENT_PKGLINT_ENV)\ + $(PKGLINT) $(CANONICAL_REPO:%=-c $(WS_LINT_CACHE)) \ + -f $(WS_TOOLS)/pkglintrc $(RESOLVED) + +FRC: + + +# published +PKGSEND_PUBLISH_OPTIONS = -s $(WS_REPO) publish --fmri-in-manifest +PKGSEND_PUBLISH_OPTIONS += $(PKG_PROTO_DIRS:%=-d %) +PKGSEND_PUBLISH_OPTIONS += -T \*.py + +# Do all the hard work that is needed to ensure the package is consistent +# and ready for publishing, except actually pushing bits to a repository +$(MANIFEST_BASE)-%.pre-published: $(MANIFEST_BASE)-%.depend.res $(BUILD_DIR)/.linted-$(MACH) + $(PKGMOGRIFY) $(PKG_OPTIONS) $< \ + $(FINAL_TRANSFORMS) | \ + sed -e '/^$$/d' -e '/^#.*$$/d' | uniq >$@ + @echo "NEW PACKAGE CONTENTS ARE LOCALLY VALIDATED AND READY TO GO" + +# Push to the repo +$(MANIFEST_BASE)-%.published: $(MANIFEST_BASE)-%.pre-published + $(PKGSEND) $(PKGSEND_PUBLISH_OPTIONS) $< + $(PKGFMT) <$< >$@ + +$(BUILD_DIR)/.pre-published-$(MACH): $(PRE_PUBLISHED) + $(TOUCH) $@ + +$(BUILD_DIR)/.published-$(MACH): $(PUBLISHED) + $(TOUCH) $@ + +print-depend-require: canonical-manifests + @echo $(call ips-print-depend-require-rule,$(NONVER_MANIFESTS)) \ + $(foreach t,$(VERSIONED_MANIFEST_TYPES),$(call ips-print-depend-require-type-rule,$(t))) | tr ' ' '\n' + +print-package-names: canonical-manifests $(MKGENERIC_SCRIPTS) + @echo $(call ips-print-names-rule,$(NONVER_MANIFESTS)) \ + $(foreach t,$(VERSIONED_MANIFEST_TYPES),\ + $(call ips-print-names-type-rule,$(t))) \ + | tr ' ' '\n' + +print-package-paths: canonical-manifests + @cat $(CANONICAL_MANIFESTS) $(WS_TOP)/transforms/print-paths | \ + $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \ + sed -e '/^$$/d' -e '/^#.*$$/d' | \ + LANG=C LC_ALL=C sort -u + +install-packages: publish + @if [ $(IS_GLOBAL_ZONE) = 0 -o x$(ROOT) != x ]; then \ + cat $(VERSIONED_MANIFESTS) $(WS_TOP)/transforms/print-paths | \ + $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \ + sed -e '/^$$/d' -e '/^#.*$$/d' -e 's;/;;' | \ + LANG=C LC_ALL=C sort -u | \ + (cd $(PROTO_DIR) ; pfexec /bin/cpio -dump $(ROOT)) ; \ + else ; \ + echo "unsafe to install package(s) automatically" ; \ + fi + +$(RESOLVED): install + +canonical-manifests: $(CANONICAL_MANIFESTS) Makefile $(PATCHES) +ifeq ($(strip $(CANONICAL_MANIFESTS)),) + # If there were no canonical manifests in the workspace, nothing will + # be published and we should fail. A sample manifest can be generated + # with + # $ gmake sample-manifest + # Once created, it will need to be reviewed, edited, and added to the + # workspace. + $(error Missing canonical manifest(s)) +endif + +# Component variables are expanded directly to PKG_OPTIONS instead of via +# PKG_MACROS since the values may contain whitespace. +mkdefine = -D $(1)="$$(strip $(2))" + +# Expand PKG_VARS into defines via PKG_OPTIONS. +$(foreach var, $(PKG_VARS), \ + $(eval PKG_OPTIONS += $(call mkdefine,$(var),$$($(var)))) \ +) + +# This converts required paths to containing package names for be able to +# properly setup the build environment for a component. +required-pkgs.mk: Makefile + @echo "generating $@ from Makefile REQUIRED_* data" + @pkg search -H -l '<$(DEPENDS:%=% OR) /bin/true>' \ + | sed -e 's/pkg:\/\(.*\)@.*/REQUIRED_PKGS += \1/g' >$@ + +pre-prep: required-pkgs.mk + + +CLEAN_PATHS += required-pkgs.mk +CLEAN_PATHS += $(BUILD_DIR)/mkgeneric-perl +CLEAN_PATHS += $(BUILD_DIR)/mkgeneric-python +CLEAN_PATHS += $(BUILD_DIR)/mkgeneric-ruby diff --git a/sample_data/make-rules/justmake.mk b/sample_data/make-rules/justmake.mk new file mode 100644 index 0000000..9dc96a5 --- /dev/null +++ b/sample_data/make-rules/justmake.mk @@ -0,0 +1,116 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# +# +# Rules and Macros for building opens source software that just uses their +# own make and no autoconf-style tools. +# +# To use these rules, include ../make-rules/justmake.mk in your Makefile +# and define "build", "install" targets appropriate to building your component. +# Ex: +# +# build: $(BUILD_32) \ +# $(BUILD_64) +# +# install: $(INSTALL_32) \ +# $(INSTALL_64) +# +# Any additional pre/post configure, build, or install actions can be specified +# in your Makefile by setting them in on of the following macros: +# COMPONENT_PRE_BUILD_ACTION, COMPONENT_POST_BUILD_ACTION +# COMPONENT_PRE_INSTALL_ACTION, COMPONENT_POST_INSTALL_ACTION +# +# If component specific make targets need to be used for build or install, they +# can be specified in +# COMPONENT_BUILD_TARGETS, COMPONENT_INSTALL_TARGETS +# + +COMPONENT_INSTALL_ARGS += DESTDIR=$(PROTO_DIR) +COMPONENT_INSTALL_ARGS += $(COMPONENT_INSTALL_ARGS.$(BITS)) + +COMPONENT_COPY_ACTION ?= \ + $(CLONEY) $(SOURCE_DIR) $(@D) + +COMPONENT_BUILD_ACTION ?= \ + cd $(@D); $(ENV) $(COMPONENT_BUILD_ENV) \ + $(GMAKE) $(COMPONENT_BUILD_GMAKE_ARGS) $(COMPONENT_BUILD_ARGS) $(COMPONENT_BUILD_TARGETS) + +# build the configured source +$(BUILD_DIR)/%/.built: $(SOURCE_DIR)/.prep + $(RM) -r $(@D) ; $(MKDIR) $(@D) + $(COMPONENT_COPY_ACTION) + $(COMPONENT_PRE_BUILD_ACTION) + ($(COMPONENT_BUILD_ACTION)) + $(COMPONENT_POST_BUILD_ACTION) +ifeq ($(strip $(PARFAIT_BUILD)),yes) + -$(PARFAIT) build +endif + $(TOUCH) $@ + +COMPONENT_INSTALL_ACTION ?= \ + cd $(@D) ; $(ENV) $(COMPONENT_INSTALL_ENV) \ + $(GMAKE) $(COMPONENT_INSTALL_ARGS) $(COMPONENT_INSTALL_TARGETS) + +# install the built source into a prototype area +$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built + $(COMPONENT_PRE_INSTALL_ACTION) + ($(COMPONENT_INSTALL_ACTION)) + $(COMPONENT_POST_INSTALL_ACTION) + $(TOUCH) $@ + +# test the built source +$(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built + $(RM) -rf $(COMPONENT_TEST_BUILD_DIR) + $(MKDIR) $(COMPONENT_TEST_BUILD_DIR) + $(COMPONENT_PRE_TEST_ACTION) + -(cd $(COMPONENT_TEST_DIR) ; \ + $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \ + $(COMPONENT_TEST_CMD) \ + $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \ + &> $(COMPONENT_TEST_OUTPUT) + $(COMPONENT_POST_TEST_ACTION) + $(COMPONENT_TEST_CREATE_TRANSFORMS) + $(COMPONENT_TEST_PERFORM_TRANSFORM) + $(COMPONENT_TEST_COMPARE) + $(COMPONENT_TEST_CLEANUP) + $(TOUCH) $@ + +$(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built + $(COMPONENT_PRE_TEST_ACTION) + (cd $(COMPONENT_TEST_DIR) ; \ + $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \ + $(COMPONENT_TEST_CMD) \ + $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) + $(COMPONENT_POST_TEST_ACTION) + $(COMPONENT_TEST_CLEANUP) + $(TOUCH) $@ + +ifeq ($(strip $(PARFAIT_BUILD)),yes) +parfait: install + -$(PARFAIT) build +else +parfait: + $(MAKE) PARFAIT_BUILD=yes parfait +endif + +clean:: + $(RM) -r $(BUILD_DIR) $(PROTO_DIR) diff --git a/sample_data/make-rules/makemaker.mk b/sample_data/make-rules/makemaker.mk new file mode 100644 index 0000000..4431c16 --- /dev/null +++ b/sample_data/make-rules/makemaker.mk @@ -0,0 +1,173 @@ + +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# + +# perl-5.22 is 32 bit (only), perl-5.24 and later are 64 bit (only) + +COMMON_PERL_ENV += MAKE=$(GMAKE) +COMMON_PERL_ENV += PATH=$(dir $(CC)):$(SPRO_VROOT)/bin:$(PATH) +COMMON_PERL_ENV += LANG="" +COMMON_PERL_ENV += CC="$(CC)" +COMMON_PERL_ENV += CFLAGS="$(CC_BITS) $(PERL_OPTIMIZE)" + +# Yes. Perl is just scripts, for now, but we need architecture +# directories so that it populates all architecture prototype +# directories. + +$(BUILD_DIR)/%-5.22/.configured: PERL_VERSION=5.22 +$(BUILD_DIR)/%-5.24/.configured: PERL_VERSION=5.24 +$(BUILD_DIR)/%-5.34/.configured: PERL_VERSION=5.34 +$(BUILD_DIR)/$(MACH32)-%/.configured: BITS=32 +$(BUILD_DIR)/$(MACH64)-%/.configured: BITS=64 + +$(BUILD_DIR)/%-5.22/.built: PERL_VERSION=5.22 +$(BUILD_DIR)/%-5.24/.built: PERL_VERSION=5.24 +$(BUILD_DIR)/%-5.34/.built: PERL_VERSION=5.34 +$(BUILD_DIR)/$(MACH32)-%/.built: BITS=32 +$(BUILD_DIR)/$(MACH64)-%/.built: BITS=64 + +$(BUILD_DIR)/%-5.22/.installed: PERL_VERSION=5.22 +$(BUILD_DIR)/%-5.24/.installed: PERL_VERSION=5.24 +$(BUILD_DIR)/%-5.34/.installed: PERL_VERSION=5.34 +$(BUILD_DIR)/$(MACH32)-%/.installed: BITS=32 +$(BUILD_DIR)/$(MACH64)-%/.installed: BITS=64 + +$(BUILD_DIR)/%-5.22/.tested: PERL_VERSION=5.22 +$(BUILD_DIR)/%-5.24/.tested: PERL_VERSION=5.24 +$(BUILD_DIR)/%-5.34/.tested: PERL_VERSION=5.34 +$(BUILD_DIR)/$(MACH32)-%/.tested: BITS=32 +$(BUILD_DIR)/$(MACH64)-%/.tested: BITS=64 + +$(BUILD_DIR)/%-5.22/.tested-and-compared: PERL_VERSION=5.22 +$(BUILD_DIR)/%-5.24/.tested-and-compared: PERL_VERSION=5.24 +$(BUILD_DIR)/%-5.34/.tested-and-compared: PERL_VERSION=5.34 +$(BUILD_DIR)/$(MACH32)-%/.tested-and-compared: BITS=32 +$(BUILD_DIR)/$(MACH64)-%/.tested-and-compared: BITS=64 + +PERL_32_ONLY_VERSIONS = $(filter-out $(PERL_64_ONLY_VERSIONS), $(PERL_VERSIONS)) + +BUILD_32 = $(PERL_32_ONLY_VERSIONS:%=$(BUILD_DIR)/$(MACH32)-%/.built) +BUILD_64 = $(PERL_64_ONLY_VERSIONS:%=$(BUILD_DIR)/$(MACH64)-%/.built) +BUILD_NO_ARCH = $(PERL_VERSIONS:%=$(BUILD_DIR)/$(MACH)-%/.built) + +ifeq ($(PERL_VERSION),5.24) +BUILD_32_and_64 = $(BUILD_64) +BUILD_64_and_32 = $(BUILD_64) +endif +ifeq ($(PERL_VERSION),5.34) +BUILD_32_and_64 = $(BUILD_64) +BUILD_64_and_32 = $(BUILD_64) +endif + +INSTALL_32 = $(PERL_32_ONLY_VERSIONS:%=$(BUILD_DIR)/$(MACH32)-%/.installed) +INSTALL_64 = $(PERL_64_ONLY_VERSIONS:%=$(BUILD_DIR)/$(MACH64)-%/.installed) +INSTALL_NO_ARCH = $(PERL_VERSIONS:%=$(BUILD_DIR)/$(MACH)-%/.installed) + +COMPONENT_CONFIGURE_ENV += $(COMMON_PERL_ENV) +COMPONENT_CONFIGURE_ENV += PERL="$(PERL)" +$(BUILD_DIR)/%/.configured: $(SOURCE_DIR)/.prep + ($(RM) -r $(@D) ; $(MKDIR) $(@D)) + $(CLONEY) $(SOURCE_DIR) $(@D) + $(COMPONENT_PRE_CONFIGURE_ACTION) + (cd $(@D) ; $(COMPONENT_CONFIGURE_ENV) $(PERL) $(PERL_FLAGS) \ + Makefile.PL $(PERL_STUDIO_OVERWRITE) $(CONFIGURE_OPTIONS)) + $(COMPONENT_POST_CONFIGURE_ACTION) + $(TOUCH) $@ + + +COMPONENT_BUILD_ENV += $(COMMON_PERL_ENV) +$(BUILD_DIR)/%/.built: $(BUILD_DIR)/%/.configured + $(COMPONENT_PRE_BUILD_ACTION) + (cd $(@D) ; $(ENV) $(COMPONENT_BUILD_ENV) \ + $(GMAKE) $(COMPONENT_BUILD_GMAKE_ARGS) $(COMPONENT_BUILD_ARGS) \ + $(COMPONENT_BUILD_TARGETS)) + $(COMPONENT_POST_BUILD_ACTION) + $(TOUCH) $@ + + +COMPONENT_INSTALL_ARGS += DESTDIR="$(PROTO_DIR)" +COMPONENT_INSTALL_TARGETS = install_vendor +COMPONENT_INSTALL_ENV += $(COMMON_PERL_ENV) +$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built + $(COMPONENT_PRE_INSTALL_ACTION) + (cd $(@D) ; $(ENV) $(COMPONENT_INSTALL_ENV) $(GMAKE) \ + $(COMPONENT_INSTALL_ARGS) $(COMPONENT_INSTALL_TARGETS)) + $(COMPONENT_POST_INSTALL_ACTION) + $(TOUCH) $@ + +# Define bit specific and Perl version specific filenames. +COMPONENT_TEST_MASTER = $(COMPONENT_TEST_RESULTS_DIR)/results-$(PERL_VERSION)-$(BITS).master +COMPONENT_TEST_OUTPUT = $(COMPONENT_TEST_BUILD_DIR)/test-$(PERL_VERSION)-$(BITS)-results +COMPONENT_TEST_DIFFS = $(COMPONENT_TEST_BUILD_DIR)/test-$(PERL_VERSION)-$(BITS)-diffs +COMPONENT_TEST_SNAPSHOT = $(COMPONENT_TEST_BUILD_DIR)/results-$(PERL_VERSION)-$(BITS).snapshot +COMPONENT_TEST_TRANSFORM_CMD = $(COMPONENT_TEST_BUILD_DIR)/transform-$(PERL_VERSION)-$(BITS)-results + +COMPONENT_TEST_TARGETS = test +COMPONENT_TEST_ENV += $(COMMON_PERL_ENV) + +# determine the type of tests we want to run. +ifeq ($(strip $(wildcard $(COMPONENT_TEST_RESULTS_DIR)/results-*.master)),) +TEST_32 = $(PERL_32_ONLY_VERSIONS:%=$(BUILD_DIR)/$(MACH32)-%/.tested) +TEST_64 = $(PERL_64_ONLY_VERSIONS:%=$(BUILD_DIR)/$(MACH64)-%/.tested) +TEST_NO_ARCH = $(PERL_VERSIONS:%=$(BUILD_DIR)/$(MACH)-%/.tested) +else +TEST_32 = $(PERL_32_ONLY_VERSIONS:%=$(BUILD_DIR)/$(MACH32)-%/.tested-and-compared) +TEST_64 = $(PERL_64_ONLY_VERSIONS:%=$(BUILD_DIR)/$(MACH64)-%/.tested-and-compared) +TEST_NO_ARCH = $(PERL_VERSIONS:%=$(BUILD_DIR)/$(MACH)-%/.tested-and-compared) +endif + +# test the built source +$(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built + $(RM) -rf $(COMPONENT_TEST_BUILD_DIR) + $(MKDIR) $(COMPONENT_TEST_BUILD_DIR) + $(COMPONENT_PRE_TEST_ACTION) + -(cd $(COMPONENT_TEST_DIR) ; \ + $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \ + $(COMPONENT_TEST_CMD) \ + $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \ + &> $(COMPONENT_TEST_OUTPUT) + $(COMPONENT_POST_TEST_ACTION) + $(COMPONENT_TEST_CREATE_TRANSFORMS) + $(COMPONENT_TEST_PERFORM_TRANSFORM) + $(COMPONENT_TEST_COMPARE) + $(COMPONENT_TEST_CLEANUP) + $(TOUCH) $@ + +$(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built + $(COMPONENT_PRE_TEST_ACTION) + (cd $(COMPONENT_TEST_DIR) ; \ + $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \ + $(COMPONENT_TEST_CMD) \ + $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) + $(COMPONENT_POST_TEST_ACTION) + $(COMPONENT_TEST_CLEANUP) + $(TOUCH) $@ + +ifeq ($(strip $(PARFAIT_BUILD)),yes) +parfait: build +else +parfait: + $(MAKE) PARFAIT_BUILD=yes parfait +endif + +clean:: + $(RM) -r $(BUILD_DIR) $(PROTO_DIR) diff --git a/sample_data/make-rules/mate.mk b/sample_data/make-rules/mate.mk new file mode 100644 index 0000000..9fe92f4 --- /dev/null +++ b/sample_data/make-rules/mate.mk @@ -0,0 +1,60 @@ +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"). You may +# only use this file in accordance with the terms 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 (c) 2021, Andreas Wacknitz. All rights reserved. +# + +COMPONENT_VERSION= $(COMPONENT_MJR_VERSION).$(COMPONENT_MNR_VERSION) +COMPONENT_PROJECT_URL= https://www.mate-desktop.org +COMPONENT_ARCHIVE_URL= https://pub.mate-desktop.org/releases/$(COMPONENT_MJR_VERSION)/$(COMPONENT_ARCHIVE) +COMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION) +COMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.xz +COMPONENT_LICENSE= GPLv2, LGPLv2, FDLv1.1 + +TEST_TARGET= $(NO_TESTS) + +PATH=$(PATH.gnu) + +COMPONENT_PREP_ACTION= cd $(@D) && NOCONFIGURE=1 ./autogen.sh + +CONFIGURE_OPTIONS+= --sysconfdir=/etc +CONFIGURE_OPTIONS+= --libexecdir=$(CONFIGURE_LIBDIR.$(BITS))/mate +CONFIGURE_OPTIONS+= --disable-static +CONFIGURE_OPTIONS+= --localstatedir=/var/lib + +CONFIGURE_ENV+= PYTHON="$(PYTHON)" + +COMPONENT_BUILD_ENV += CC="$(CC)" +COMPONENT_BUILD_ENV += CFLAGS="$(CFLAGS)" + +# +# Set defaults for Mate libraries +# +ifeq ($(strip $(MATE_CATEGORY)),LIB) +BUILD_BITS = 32_and_64 +COMPONENT_CLASSIFICATION= System/Libraries +COMPONENT_FMRI= library/desktop/mate/$(COMPONENT_NAME) +endif + + +# +# Set defaults for Mate applications +# +ifeq ($(strip $(MATE_CATEGORY)),APP) +BUILD_BITS = 64 +PREFERRED_BITS= 64 +COMPONENT_FMRI= desktop/mate/$(COMPONENT_NAME) +endif + +# Default build dependencies +REQUIRED_PACKAGES += developer/build/autoconf +REQUIRED_PACKAGES += developer/build/pkg-config +REQUIRED_PACKAGES += developer/documentation-tool/gtk-doc +REQUIRED_PACKAGES += library/desktop/mate/mate-common diff --git a/sample_data/make-rules/meson.mk b/sample_data/make-rules/meson.mk new file mode 100644 index 0000000..6cfa886 --- /dev/null +++ b/sample_data/make-rules/meson.mk @@ -0,0 +1,166 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. +# + +# +# Rules and Macros for building open source software that uses meson +# to configure their build for the system they are on. It then includes +# ninja.mk to handle the build/install/test macros +# +# To use these rules in your component Makefile, set BUILD_STYLE=meson and +# then include $(WS_MAKE_RULES)/common.mk. +# +# Any additional pre/post configure actions can be specified +# in your make file by setting them in one of the following macros: +# COMPONENT_PRE_CONFIGURE_ACTION, COMPONENT_POST_CONFIGURE_ACTION +# + +CONFIGURE_PREFIX ?= /usr + +# When debugging a component, override this to be debug or debugoptimized +MESON_BUILDTYPE ?= plain + +ifeq ($(strip $(MESON_BUILDTYPE)), debug) +MESON_OPTIMIZATION ?= g +else +MESON_OPTIMIZATION ?= 3 +endif + +MESON_BUILDPIE ?= false + +# If the component prefers 64-bit binaries, then ensure builds deliver 64-bit +# binaries to the standard directories and 32-bit binaries to the non-standard +# location. This allows simplification of package manifests and makes it +# easier to deliver the 64-bit binaries as the default. +ifeq ($(strip $(PREFERRED_BITS)),64) +CONFIGURE_BINDIR.32 ?= $(CONFIGURE_PREFIX)/bin/$(MACH32) +CONFIGURE_SBINDIR.32 ?= $(CONFIGURE_PREFIX)/sbin/$(MACH32) +CONFIGURE_BINDIR.64 ?= $(CONFIGURE_PREFIX)/bin +CONFIGURE_SBINDIR.64 ?= $(CONFIGURE_PREFIX)/sbin +else +CONFIGURE_BINDIR.32 ?= $(CONFIGURE_PREFIX)/bin +CONFIGURE_SBINDIR.32 ?= $(CONFIGURE_PREFIX)/sbin +CONFIGURE_BINDIR.64 ?= $(CONFIGURE_PREFIX)/bin/$(MACH64) +CONFIGURE_SBINDIR.64 ?= $(CONFIGURE_PREFIX)/sbin/$(MACH64) +endif + +# Regardless of PREFERRED_BITS, 64-bit libraries should always be delivered to +# the appropriate subdirectory by default. +CONFIGURE_LIBDIR.32 ?= $(CONFIGURE_PREFIX)/lib +CONFIGURE_LIBDIR.64 ?= $(CONFIGURE_PREFIX)/lib/$(MACH64) + +CONFIGURE_MANDIR ?= $(CONFIGURE_PREFIX)/share/man +CONFIGURE_LOCALEDIR ?= $(CONFIGURE_PREFIX)/share/locale +# all texinfo documentation seems to go to /usr/share/info no matter what +CONFIGURE_INFODIR ?= /usr/share/info +CONFIGURE_INCLUDEDIR ?= /usr/include + +# Some components require an architecture-specific directory for their +# configuration, so these are specified per-bits. +CONFIGURE_ETCDIR.32 ?= $(ETCDIR) +CONFIGURE_ETCDIR.64 ?= $(ETCDIR) + +CONFIGURE_DEFAULT_DIRS?=yes + +CONFIGURE_ENV += PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" +CONFIGURE_ENV += CC="$(CC)" +CONFIGURE_ENV += CXX="$(CXX)" +CONFIGURE_ENV += F77="$(F77)" +CONFIGURE_ENV += FC="$(FC)" +ifneq ($(strip $(CFLAGS)),) +CONFIGURE_ENV += CFLAGS="$(strip $(CFLAGS))" +endif +ifneq ($(strip $(CXXFLAGS)),) +CONFIGURE_ENV += CXXFLAGS="$(strip $(CXXFLAGS))" +endif +CONFIGURE_CPPFLAGS ?= $(CC_BITS) +ifneq ($(strip $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)),) +CONFIGURE_ENV += CPPFLAGS="$(strip $(CONFIGURE_CPPFLAGS) $(CPPFLAGS))" +endif +CONFIGURE_ENV += LDFLAGS="$(strip $(LDFLAGS))" +ifneq ($(strip $(F77FLAGS)),) +CONFIGURE_ENV += FFLAGS="$(strip $(F77FLAGS))" +endif +ifneq ($(strip $(FCFLAGS)),) +CONFIGURE_ENV += FCFLAGS="$(strip $(FCFLAGS))" +endif + +# Options here should be limited to the built-in options listed on +# https://mesonbuild.com/Builtin-options.html +CONFIGURE_OPTIONS += --buildtype=$(MESON_BUILDTYPE) +CONFIGURE_OPTIONS += --optimization=$(MESON_OPTIMIZATION) +CONFIGURE_OPTIONS += -Ddefault_library=shared +CONFIGURE_OPTIONS += -Db_pie=$(MESON_BUILDPIE) + +# Install paths +CONFIGURE_OPTIONS += --prefix=$(CONFIGURE_PREFIX) +ifeq ($(CONFIGURE_DEFAULT_DIRS),yes) +CONFIGURE_OPTIONS += --bindir="$(CONFIGURE_BINDIR.$(BITS))" +CONFIGURE_OPTIONS += --sbindir="$(CONFIGURE_SBINDIR.$(BITS))" +CONFIGURE_OPTIONS += --libdir="$(CONFIGURE_LIBDIR.$(BITS))" +CONFIGURE_OPTIONS += --libexecdir="$(CONFIGURE_LIBDIR.32)" +CONFIGURE_OPTIONS += --localstatedir="$(VARDIR)" +CONFIGURE_OPTIONS += --mandir="$(CONFIGURE_MANDIR)" +CONFIGURE_OPTIONS += --sysconfdir="$(CONFIGURE_ETCDIR.$(BITS))" +endif +CONFIGURE_OPTIONS += $(CONFIGURE_OPTIONS.$(BITS)) +CONFIGURE_OPTIONS += $(CONFIGURE_OPTIONS.$(MACH)) +CONFIGURE_OPTIONS += $(CONFIGURE_OPTIONS.$(MACH).$(BITS)) + +$(BUILD_DIR_32)/.configured: BITS=32 +$(BUILD_DIR_64)/.configured: BITS=64 + +CONFIGURE_ENV += $(CONFIGURE_ENV.$(BITS)) + +# This MUST be set in the build environment so that if pkg-config is executed +# during the build process, the correct header files and libraries will be +# picked up. In the Linux world, a system is generally only 32-bit or 64-bit +# at one time so this isn't an issue that various auto* files account for (they +# don't set PKG_CONFIG_PATH when executing pkg-config even if it was specified +# during ./configure). +COMPONENT_BUILD_ENV += PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" + +MESON = /usr/bin/meson + +# configure the unpacked source for building 32 and 64 bit version +# meson insists on separate source & build directories, so no cloney here. +$(BUILD_DIR)/%/.configured: $(SOURCE_DIR)/.prep + ($(RM) -rf $(@D) ; $(MKDIR) $(@D)) + $(COMPONENT_PRE_CONFIGURE_ACTION) + (cd $(SOURCE_DIR) ; $(ENV) $(CONFIGURE_ENV) $(MESON) setup $(@D) \ + $(CONFIGURE_OPTIONS)) + $(COMPONENT_POST_CONFIGURE_ACTION) + $(TOUCH) $@ + +# If BUILD_STYLE is set, provide a default configure target. +ifeq ($(strip $(BUILD_STYLE)),meson) +configure: $(CONFIGURE_$(MK_BITS)) +endif + +REQUIRED_PACKAGES += developer/build/meson + +# Meson generates build.ninja files for the ninja build tool to run, +# so we include ninja.mk for the build/install/test rules + +include $(WS_MAKE_RULES)/ninja.mk diff --git a/sample_data/make-rules/modules.mk b/sample_data/make-rules/modules.mk new file mode 100644 index 0000000..f45925e --- /dev/null +++ b/sample_data/make-rules/modules.mk @@ -0,0 +1,29 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 2015, Aurelien Larcher. All rights reserved. +# + +MODULES_ENV= . /etc/profile.d/modules.sh + +MODULE_PURGE= module purge +MODULE_LOAD= module load +MODULE_UNLOAD= module unload + diff --git a/sample_data/make-rules/mpi-macros.mk b/sample_data/make-rules/mpi-macros.mk new file mode 100644 index 0000000..9b0e02e --- /dev/null +++ b/sample_data/make-rules/mpi-macros.mk @@ -0,0 +1,156 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 2013-2017, Aurelien Larcher. All rights reserved. +# + +MPI_IMPLEMENTATIONS_LIST = mpich openmpi + +# Define compilers +MPI.mpich = mpich + +MPICC.mpich = mpicc +MPICXX.mpich = mpicxx +MPIF77.mpich = mpif77 +MPIFC.mpich = mpif90 + +MPI.openmpi = openmpi + +MPICC.openmpi = mpicc +MPICXX.openmpi = mpicxx +MPIF77.openmpi = mpif77 +MPIFC.openmpi = mpif90 + +# Default to mpich +MPI_IMPLEMENTATION ?= $(MPI.mpich) + +MPICC = $(MPICC.$(MPI_IMPLEMENTATION)) +MPICXX = $(MPICXX.$(MPI_IMPLEMENTATION)) +MPIF77 = $(MPIF77.$(MPI_IMPLEMENTATION)) +MPIFC = $(MPIFC.$(MPI_IMPLEMENTATION)) + +# Define compiler enviromnent +MPI_COMPILER = $(COMPILER) +MPI_COMPILER_ROOT= +MPI_COMPILER_LIBDIR= + +ifeq ($(strip $(MPI_COMPILER)),gcc) + +MPI_COMPILER_ROOT=$(GCC_ROOT) +MPI_COMPILER_LIBDIR=$(MPI_COMPILER_ROOT)/lib/$(ARCHLIBSUBDIR$(BITS)) + +endif + +# Define implementation specific paths +MPI_BUNDLE = $(MPI_IMPLEMENTATION)-$(MPI_COMPILER) + +MPI_PREFIX.32 = $(USRLIBDIR)/$(MPI_IMPLEMENTATION)/$(MPI_COMPILER) +MPI_PREFIX.64 = $(USRLIBDIR64)/$(MPI_IMPLEMENTATION)/$(MPI_COMPILER) +MPI_PREFIX = $(MPI_PREFIX.$(BITS)) + +MPI_BINDIR.32 = $(MPI_PREFIX.32)/bin +MPI_BINDIR.64 = $(MPI_PREFIX.64)/bin +MPI_BINDIR = $(MPI_BINDIR.$(BITS)) + +MPI_SBINDIR.32 = $(MPI_PREFIX.32)/sbin +MPI_SBINDIR.64 = $(MPI_PREFIX.64)/sbin +MPI_SBINDIR = $(MPI_SBINDIR.$(BITS)) + +MPI_LIBDIR.32 = $(MPI_PREFIX.32)/lib +MPI_LIBDIR.64 = $(MPI_PREFIX.64)/lib +MPI_LIBDIR = $(MPI_LIBDIR.$(BITS)) + +MPI_ETCDIR.32 = $(MPI_PREFIX.32)/etc +MPI_ETCDIR.64 = $(MPI_PREFIX.64)/etc +MPI_ETCDIR = $(MPI_ETCDIR.$(BITS)) + +MPI_INCDIR = $(USRINCDIR)/$(MPI_IMPLEMENTATION) + +MPI_SHAREDIR = $(USRSHAREDIR) +MPI_DATADIR = $(MPI_SHAREDIR)/$(MPI_IMPLEMENTATION) +MPI_DOCDIR = $(USRSHAREDOCDIR)/$(MPI_IMPLEMENTATION) +MPI_HTMLDIR = $(USRSHAREDOCDIR)/www +MPI_MANDIR = $(USRSHAREMANDIR) + + +# Create meta rule to trigger build for each listed implementation + +ifneq ($(strip $(COMPONENT_MPI_BUILD)),) + +$(BUILD_DIR_32)/%/.configured: BITS=32 +$(BUILD_DIR_64)/%/.configured: BITS=64 + +$(BUILD_DIR_32)/%/.built: BITS=32 +$(BUILD_DIR_64)/%/.built: BITS=64 + +BUILD_32= +BUILD_64= + +$(BUILD_DIR_32)/%/.installed: BITS=32 +$(BUILD_DIR_64)/%/.installed: BITS=64 + +INSTALL_32= +INSTALL_64= + +$(BUILD_DIR_32)/%/.tested: BITS=32 +$(BUILD_DIR_64)/%/.tested: BITS=64 + +$(BUILD_DIR_32)/%/.tested-and-compared: BITS=32 +$(BUILD_DIR_64)/%/.tested-and-compared: BITS=64 + +TEST_32= +TEST_64= + +define mpi-rule + +BUILD_DIR_32_$(1) = $$(BUILD_DIR)/$$(MACH32)/$(1) +BUILD_DIR_64_$(1) = $$(BUILD_DIR)/$$(MACH64)/$(1) + +$(BUILD_DIR)/%/$(1)/.configured: MPI_IMPLEMENTATION=$(1) + +$(BUILD_DIR)/%/$(1)/.built: MPI_IMPLEMENTATION=$(1) + +BUILD_32+= $$(BUILD_DIR_32_$(1))/.built +BUILD_64+= $$(BUILD_DIR_64_$(1))/.built + +$(BUILD_DIR)/%/$(1)/.installed: MPI_IMPLEMENTATION=$(1) + +INSTALL_32+= $$(BUILD_DIR_32_$(1))/.installed +INSTALL_64+= $$(BUILD_DIR_64_$(1))/.installed + +$(BUILD_DIR)/%/$(1)/.tested: MPI_IMPLEMENTATION=$(1) + +$(BUILD_DIR)/%/$(1)/.tested-and-compared: MPI_IMPLEMENTATION=$(1) + +ifeq ($(strip $(wildcard $(COMPONENT_TEST_RESULTS_DIR)/results-*.master)),) +TEST_32+= $$(BUILD_DIR_32_$(1))/.tested +TEST_64+= $$(BUILD_DIR_64_$(1))/.tested +else +TEST_32+= $$(BUILD_DIR_32_$(1))/.tested-and-compared +TEST_64+= $$(BUILD_DIR_64_$(1))/.tested-and-compared +endif + +endef + +$(foreach mpi, $(COMPONENT_MPI_BUILD), $(eval $(call mpi-rule,$(mpi)))) + +endif + +COMPONENT_MPI_BUILD_DIR= $(BUILD_DIR_$(BITS)_$(MPI_IMPLEMENTATION)) diff --git a/sample_data/make-rules/ninja.mk b/sample_data/make-rules/ninja.mk new file mode 100644 index 0000000..9578dee --- /dev/null +++ b/sample_data/make-rules/ninja.mk @@ -0,0 +1,119 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. +# +# +# Rules and Macros for building open source software that builds with +# ninja (whether using a provided ninja file or one generated by a tool +# such as meson). +# +# To use these rules on their own, set BUILD_STYLE=ninja before including +# $(WS_MAKE_RULES)/common.mk. They will also be used for the build rules +# if you set BUILD_STYLE=meson. +# +# Any additional pre/post configure, build, or install actions can be specified +# in your Makefile by setting them in on of the following macros: +# COMPONENT_PRE_BUILD_ACTION, COMPONENT_BUILD_ACTION, +# COMPONENT_POST_BUILD_ACTION, COMPONENT_PRE_INSTALL_ACTION, +# COMPONENT_INSTALL_ACTION, COMPONENT_POST_INSTALL_ACTION +# +# If component specific ninja targets need to be used for build or install, they +# can be specified in +# COMPONENT_BUILD_TARGETS, COMPONENT_INSTALL_TARGETS +# + +NINJA = /usr/bin/ninja + +COMPONENT_INSTALL_ENV += DESTDIR=$(PROTO_DIR) +COMPONENT_INSTALL_ARGS += $(COMPONENT_INSTALL_ARGS.$(BITS)) + +COMPONENT_BUILD_ACTION ?= \ + $(ENV) $(COMPONENT_BUILD_ENV) \ + $(NINJA) -C $(@D) $(COMPONENT_BUILD_ARGS) $(COMPONENT_BUILD_TARGETS) + +# build the configured source +$(BUILD_DIR)/%/.built: $(BUILD_DIR)/%/.configured + $(COMPONENT_PRE_BUILD_ACTION) + ($(COMPONENT_BUILD_ACTION)) + $(COMPONENT_POST_BUILD_ACTION) +ifeq ($(strip $(PARFAIT_BUILD)),yes) + -$(PARFAIT) $(@D) +endif + $(TOUCH) $@ + +COMPONENT_INSTALL_ACTION ?= \ + $(ENV) $(COMPONENT_INSTALL_ENV) \ + $(NINJA) -C $(@D) $(COMPONENT_INSTALL_ARGS) $(COMPONENT_INSTALL_TARGETS) + +# install the built source into a prototype area +$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built + $(COMPONENT_PRE_INSTALL_ACTION) + ($(COMPONENT_INSTALL_ACTION)) + $(COMPONENT_POST_INSTALL_ACTION) + $(TOUCH) $@ + +# set the default command to use for test of the component +COMPONENT_TEST_CMD = $(NINJA) +COMPONENT_SYSTEM_TEST_CMD = $(NINJA) + +# set the default target for test of the component +COMPONENT_TEST_TARGETS = test +COMPONENT_SYSTEM_TEST_TARGETS = test + +# test the built source +$(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built + $(RM) -rf $(COMPONENT_TEST_BUILD_DIR) + $(MKDIR) $(COMPONENT_TEST_BUILD_DIR) + $(COMPONENT_PRE_TEST_ACTION) + -(cd $(COMPONENT_TEST_DIR) ; \ + $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \ + $(COMPONENT_TEST_CMD) \ + $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \ + &> $(COMPONENT_TEST_OUTPUT) + $(COMPONENT_POST_TEST_ACTION) + $(COMPONENT_TEST_CREATE_TRANSFORMS) + $(COMPONENT_TEST_PERFORM_TRANSFORM) + $(COMPONENT_TEST_COMPARE) + $(COMPONENT_TEST_CLEANUP) + $(TOUCH) $@ + +$(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built + $(COMPONENT_PRE_TEST_ACTION) + (cd $(COMPONENT_TEST_DIR) ; \ + $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \ + $(COMPONENT_TEST_CMD) \ + $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) + $(COMPONENT_POST_TEST_ACTION) + $(COMPONENT_TEST_CLEANUP) + $(TOUCH) $@ + +ifeq ($(strip $(PARFAIT_BUILD)),yes) +parfait: build +else +parfait: + $(MAKE) PARFAIT_BUILD=yes parfait +endif + +clean:: + $(RM) -r $(BUILD_DIR) $(PROTO_DIR) +REQUIRED_PACKAGES += developer/build/ninja diff --git a/sample_data/make-rules/ocaml.mk b/sample_data/make-rules/ocaml.mk new file mode 100644 index 0000000..b5d5364 --- /dev/null +++ b/sample_data/make-rules/ocaml.mk @@ -0,0 +1,19 @@ +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"). You may +# only use this file in accordance with the terms 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 (c) 2020, Aurelien Larcher. All rights reserved. +# + +OCAML_ETCDIR = $(ETCDIR)/ocaml +OCAML_LIBDIR = $(USRLIBDIR64)/ocaml + +# Select preferred Python version +OCAML_PYTHON_VERSION = 3.5 +PYTHON_VERSION = $(OCAML_PYTHON_VERSION) diff --git a/sample_data/make-rules/prep-download.mk b/sample_data/make-rules/prep-download.mk new file mode 100644 index 0000000..3dc0704 --- /dev/null +++ b/sample_data/make-rules/prep-download.mk @@ -0,0 +1,84 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. +# + +FETCH = $(WS_TOOLS)/userland-fetch + +# +# Anything that we download must have a COMPONENT_ARCHIVE_URL{_[0-9]+} macro +# that tells us where the canonical source for the archive can be found. The +# macro for the first archive is typically un-suffixed. By convention, +# subsequent archives will include a _[0-9]+ in the macro name. This allows +# an arbitrary number of archives to be downloaded for a particular component +# Makefile. It is also important to note that there is a corresponding +# COMPONENT_ARCHIVE macro defining a local file name for the archive, and +# optional COMPONENT_ARCHIVE_HASH and COMPONENT_SIG_URL containing a hash of +# the file and signature for verification of its contents. +# + +URL_SUFFIXES = $(subst COMPONENT_ARCHIVE_URL_,, \ + $(filter COMPONENT_ARCHIVE_URL_%, $(.VARIABLES))) + +# Argument to "userland-fetch" script that causes it to download and verify +# files, but not to remove mismatches; good to save traffic when initially +# fetching a new archive just to learn what checksum to expect in Makefile. +#FETCH_KEEP ?= --keep +FETCH_KEEP ?= + +# Template for download rules. +define download-rules +ifdef COMPONENT_ARCHIVE_URL$(1) + +ARCHIVES += $$(COMPONENT_ARCHIVE$(1)) +CLOBBER_PATHS += $$(COMPONENT_ARCHIVE$(1)) + +fetch:: FETCH_KEEP=--keep +fetch:: $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)) + +download:: $$(USERLAND_ARCHIVES) +download:: $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)) + +$$(USERLAND_ARCHIVES): + $$(MKDIR) $$(USERLAND_ARCHIVES) + +$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)): $(MAKEFILE_PREREQ) + $$(FETCH) $$(FETCH_KEEP) --file $$@ \ + $$(COMPONENT_ARCHIVE_URL$(1):%=--url %) \ + $$(COMPONENT_ARCHIVE_HASH$(1):%=--hash %) \ + $$(COMPONENT_SIG_URL$(1):%=--sigurl %) \ + $$(if $$(COMPONENT_FETCH_USER_AGENT$(1)),--user-agent $$(COMPONENT_FETCH_USER_AGENT$(1))) + $$(TOUCH) $$@ + +USERLAND_REQUIRED_PACKAGES += runtime/python-27 + +endif +endef + +# +# Define the rules required to download any source archives and augment any +# cleanup macros. +# +$(eval $(call download-rules,)) +$(foreach suffix, $(URL_SUFFIXES), $(eval $(call download-rules,_$(suffix)))) + +# Needed for signature validation of downloads +USERLAND_REQUIRED_PACKAGES += crypto/gnupg diff --git a/sample_data/make-rules/prep-git.mk b/sample_data/make-rules/prep-git.mk new file mode 100644 index 0000000..c753412 --- /dev/null +++ b/sample_data/make-rules/prep-git.mk @@ -0,0 +1,127 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. +# + +GIT = /usr/bin/git + +COMPONENT_PREP_GIT?=yes +ifeq ($(strip $(COMPONENT_PREP_GIT)), yes) + +# +# Anything that we pull from a GIT repo must have a GIT_REPO{_[0-9]+} and +# GIT_COMMIT_ID{_[0-9]+} to match. +# + +GIT_SUFFIXES = $(subst GIT_REPO_,, $(filter GIT_REPO_%, $(.VARIABLES))) + +# Templates for git variables and rules. We separate the variable assignments +# from the rules so that all the variable assignments are given a chance to +# complete before those variables are used in targets or prerequisites, where +# they'll be expanded immediately. +define git-variables +ifdef GIT_REPO$(1) +ifeq ("",$(strip $(or $(GIT_BRANCH$(1)),$(GIT_COMMIT_ID$(1))))) + $$(error GIT_BRANCH$(1) and/or GIT_COMMIT_ID$(1) must be defined) +endif + +ifdef GIT_BRANCH$(1) + GIT_BRANCH_ARG$(1) = -b $$(GIT_BRANCH$(1)) +else + GIT_BRANCH_ARG$(1) = -b master +endif + +# If the label is not already defined (including to empty), set it to the version. +COMPONENT_LABEL$(1) ?= $$(COMPONENT_VERSION$(1)) +# The source directory is -(