Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update noarch build #6250

Merged
merged 18 commits into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion .github/actions/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ for i in {5..7}; do
ffmpeg_dependent_packages=$(find spk/ -maxdepth 2 -mindepth 2 -name "Makefile" -exec grep -Ho "FFMPEG_PACKAGE = ffmpeg${i}" {} \; | grep -Po ".*spk/\K[^/]*" | sort | tr '\n' ' ')

# If packages contain a package that depends on ffmpeg (or is ffmpeg),
# then ensure relevant ffmpeg5|ffmpeg6 is first in list
# then ensure relevant ffmpeg spk is first in list
for package in ${packages}
do
if [ "$(echo ffmpeg${i} ${ffmpeg_dependent_packages} | grep -ow ${package})" != "" ]; then
Expand Down Expand Up @@ -107,19 +107,43 @@ all_noarch=$(find spk/ -maxdepth 2 -mindepth 2 -name "Makefile" -exec grep -Ho "
# and filter out packages that are removed or do not exist (e.g. nzbdrone)
arch_packages=
noarch_packages=
has_arch_packages='false'
has_noarch_packages='false'
for package in ${packages}
do
if [ -f "./spk/${package}/Makefile" ]; then
if [ "$(echo ${all_noarch} | grep -ow ${package})" = "" ]; then
arch_packages+="${package} "
has_arch_packages='true'
else
noarch_packages+="${package} "
has_noarch_packages='true'
fi
fi
done

# evaluate packages that require DSM 7.2
min_dsm72_packages=
has_min_dsm72_packages='false'
for package in ${packages}
do
if [ -f "./spk/${package}/Makefile" ]; then
if [ "$(grep REQUIRED_MIN_DSM ./spk/${package}/Makefile | cut -d= -f2 | xargs)" = "7.2" ]; then
min_dsm72_packages+="${package} "
has_min_dsm72_packages='true'
fi
fi
done

if [ "${has_min_dsm72_packages}" = "true" ]; then
echo "===> Min DSM 7.2 packages found: ${min_dsm72_packages}"
fi

echo "arch_packages=${arch_packages}" >> $GITHUB_OUTPUT
echo "noarch_packages=${noarch_packages}" >> $GITHUB_OUTPUT
echo "has_arch_packages=${has_arch_packages}" >> $GITHUB_OUTPUT
echo "has_noarch_packages=${has_noarch_packages}" >> $GITHUB_OUTPUT
echo "has_min_dsm72_packages=${has_min_dsm72_packages}" >> $GITHUB_OUTPUT

echo "::endgroup::"

Expand Down
84 changes: 60 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
package:
description: 'Package to build'
required: true
default: 'syno-magnet'
default: 'adminer'
publish:
description: 'Publish to repository'
required: false
Expand All @@ -15,6 +15,14 @@ on:
options:
- 'true'
- 'false'
add_noarch_builds:
description: 'Include noarch packages'
required: false
default: 'true'
type: choice
options:
- 'true'
- 'false'
add_dsm72_builds:
description: 'Include DSM 7.2 archs'
required: false
Expand Down Expand Up @@ -76,6 +84,12 @@ jobs:
outputs:
arch_packages: ${{ steps.dependencies.outputs.arch_packages }}
noarch_packages: ${{ steps.dependencies.outputs.noarch_packages }}
add_noarch_builds: ${{ steps.set-defaults.outputs.add_noarch_builds }}
add_dsm72_builds: ${{ steps.set-defaults.outputs.add_dsm72_builds }}
add_dsm71_builds: ${{ steps.set-defaults.outputs.add_dsm71_builds }}
add_dsm62_builds: ${{ steps.set-defaults.outputs.add_dsm62_builds }}
add_dsm52_builds: ${{ steps.set-defaults.outputs.add_dsm52_builds }}
add_srm12_builds: ${{ steps.set-defaults.outputs.add_srm12_builds }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -104,6 +118,17 @@ jobs:
GH_FILES: ${{ steps.getfile.outputs.files }} ${{ steps.getfile_pr.outputs.files }}
SPK_TO_BUILD: ${{ github.event.inputs.package }}

# Set default values for all builds (manual or automated)
- name: Set default values for generate matrix
id: set-defaults
run: |
echo "add_noarch_builds=${{ github.event.inputs.add_noarch_builds || steps.dependencies.outputs.has_noarch_packages }}" >> $GITHUB_OUTPUT
echo "add_dsm72_builds=${{ github.event.inputs.add_dsm72_builds || steps.dependencies.outputs.has_min_dsm72_packages }}" >> $GITHUB_OUTPUT
echo "add_dsm71_builds=${{ github.event.inputs.add_dsm71_builds || steps.dependencies.outputs.has_arch_packages }}" >> $GITHUB_OUTPUT
echo "add_dsm62_builds=${{ github.event.inputs.add_dsm62_builds || steps.dependencies.outputs.has_arch_packages }}" >> $GITHUB_OUTPUT
echo "add_dsm52_builds=${{ github.event.inputs.add_dsm52_builds || 'false' }}" >> $GITHUB_OUTPUT
echo "add_srm12_builds=${{ github.event.inputs.add_srm12_builds || 'false' }}" >> $GITHUB_OUTPUT

- name: Cache downloaded files
uses: actions/cache@v4
with:
Expand All @@ -119,26 +144,43 @@ jobs:
NOARCH_PACKAGES: ${{ needs.prepare.outputs.noarch_packages }}

generate_matrix:
name: Prepare Architectures
name: Generate Matrix
needs: prepare
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
# Start with the noarch architectures at the top
matrix='{"include": ['
matrix+='{"arch": "noarch"},'
matrix+='{"arch": "noarch-6.1"},'
matrix+='{"arch": "noarch-7.0"},'
# Use the default values passed from the prepare step
add_noarch_builds=${{ needs.prepare.outputs.add_noarch_builds }}
add_dsm72_builds=${{ needs.prepare.outputs.add_dsm72_builds }}
add_dsm71_builds=${{ needs.prepare.outputs.add_dsm71_builds }}
add_dsm62_builds=${{ needs.prepare.outputs.add_dsm62_builds }}
add_dsm52_builds=${{ needs.prepare.outputs.add_dsm52_builds }}
add_srm12_builds=${{ needs.prepare.outputs.add_srm12_builds }}

# Add other architectures based on input flags
if [ "${{ github.event.inputs.add_dsm52_builds }}" == "true" ]; then
matrix+='{"arch": "x86-5.2"},'
matrix+='{"arch": "88f6281-5.2"},'
matrix+='{"arch": "ppc853x-5.2"},'
# Create matrix as a JSON object
matrix='{"include": ['

if [ "$add_noarch_builds" == "true" ]; then
matrix+='{"arch": "noarch-1.1"},'
matrix+='{"arch": "noarch-3.1"},'
matrix+='{"arch": "noarch-6.1"},'
matrix+='{"arch": "noarch-7.0"},'
fi
if [ "${{ github.event.inputs.add_dsm62_builds }}" == "true" ]; then
if [ "$add_dsm72_builds" == "true" ]; then
matrix+='{"arch": "x64-7.2"},'
matrix+='{"arch": "aarch64-7.2"},'
fi
if [ "$add_dsm71_builds" == "true" ]; then
matrix+='{"arch": "x64-7.1"},'
matrix+='{"arch": "aarch64-7.1"},'
matrix+='{"arch": "evansport-7.1"},'
matrix+='{"arch": "armv7-7.1"},'
matrix+='{"arch": "comcerto2k-7.1"},'
fi
if [ "$add_dsm62_builds" == "true" ]; then
matrix+='{"arch": "x64-6.2.4"},'
matrix+='{"arch": "aarch64-6.2.4"},'
matrix+='{"arch": "evansport-6.2.4"},'
Expand All @@ -147,18 +189,12 @@ jobs:
matrix+='{"arch": "88f6281-6.2.4"},'
matrix+='{"arch": "qoriq-6.2.4"},'
fi
if [ "${{ github.event.inputs.add_dsm71_builds }}" == "true" ]; then
matrix+='{"arch": "x64-7.1"},'
matrix+='{"arch": "aarch64-7.1"},'
matrix+='{"arch": "evansport-7.1"},'
matrix+='{"arch": "armv7-7.1"},'
matrix+='{"arch": "comcerto2k-7.1"},'
fi
if [ "${{ github.event.inputs.add_dsm72_builds }}" == "true" ]; then
matrix+='{"arch": "x64-7.2"},'
matrix+='{"arch": "aarch64-7.2"},'
if [ "$add_dsm52_builds" == "true" ]; then
matrix+='{"arch": "x86-5.2"},'
matrix+='{"arch": "88f6281-5.2"},'
matrix+='{"arch": "ppc853x-5.2"},'
fi
if [ "${{ github.event.inputs.add_srm12_builds }}" == "true" ]; then
if [ "$add_srm12_builds" == "true" ]; then
matrix+='{"arch": "armv7-1.2"},'
fi

Expand Down
2 changes: 2 additions & 0 deletions mk/spksrc.cross-cc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ DIST_FILE = $(DISTRIB_DIR)/$(LOCAL_FILE)
DIST_EXT = $(PKG_EXT)

ifneq ($(ARCH),)
ifneq ($(ARCH),noarch)
ARCH_SUFFIX = -$(ARCH)-$(TCVERSION)
TC = syno$(ARCH_SUFFIX)
endif
endif

#####

Expand Down
2 changes: 2 additions & 0 deletions mk/spksrc.cross-cmake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ DIST_FILE = $(DISTRIB_DIR)/$(LOCAL_FILE)
DIST_EXT = $(PKG_EXT)

ifneq ($(ARCH),)
ifneq ($(ARCH),noarch)
ARCH_SUFFIX = -$(ARCH)-$(TCVERSION)
TC = syno$(ARCH_SUFFIX)
endif
endif

###

Expand Down
2 changes: 2 additions & 0 deletions mk/spksrc.cross-dotnet.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ DIST_FILE = $(DISTRIB_DIR)/$(LOCAL_FILE)
DIST_EXT = $(PKG_EXT)

ifneq ($(ARCH),)
ifneq ($(ARCH),noarch)
ARCH_SUFFIX = -$(ARCH)-$(TCVERSION)
TC = syno$(ARCH_SUFFIX)
endif
endif

##### dotnet specific configurations
include ../../mk/spksrc.cross-dotnet-env.mk
Expand Down
2 changes: 2 additions & 0 deletions mk/spksrc.cross-go.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ DIST_FILE = $(DISTRIB_DIR)/$(LOCAL_FILE)
DIST_EXT = $(PKG_EXT)

ifneq ($(ARCH),)
ifneq ($(ARCH),noarch)
ARCH_SUFFIX = -$(ARCH)-$(TCVERSION)
TC = syno$(ARCH_SUFFIX)
endif
endif

##### golang specific configurations
include ../../mk/spksrc.cross-go-env.mk
Expand Down
2 changes: 2 additions & 0 deletions mk/spksrc.cross-rust-env.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ endif
# When calling directly from toolchain/syno-<arch>-<version>
# ARCH variable is still unset thus using $(TC_ARCH) although
# in generic archs we must rely on $(TC_NANE)
ifneq ($(ARCH),noarch)
RUST_ARCH = $(or $(ARCH),$(lastword $(subst -, ,$(TC_NAME))),$(TC_ARCH))
endif

# When building toolchain Tier-3 arch support
# While stage-2 is the truly current compiler, stage-1 suffice our needs
Expand Down
2 changes: 2 additions & 0 deletions mk/spksrc.cross-rust.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ DIST_FILE = $(DISTRIB_DIR)/$(LOCAL_FILE)
DIST_EXT = $(PKG_EXT)

ifneq ($(ARCH),)
ifneq ($(ARCH),noarch)
ARCH_SUFFIX = -$(ARCH)-$(TCVERSION)
TC = syno$(ARCH_SUFFIX)
endif
endif

##### rust specific configurations
include ../../mk/spksrc.cross-rust-env.mk
Expand Down
2 changes: 2 additions & 0 deletions mk/spksrc.install-resources.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ DIST_FILE = $(DISTRIB_DIR)/$(LOCAL_FILE)
DIST_EXT = $(PKG_EXT)

ifneq ($(ARCH),)
ifneq ($(ARCH),noarch)
ARCH_SUFFIX = -$(ARCH)-$(TCVERSION)
TC = syno$(ARCH_SUFFIX)
endif
endif


#####
Expand Down
2 changes: 2 additions & 0 deletions mk/spksrc.main-depends.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ NAME = $(PKG_NAME)
COOKIE_PREFIX = $(PKG_NAME)-

ifneq ($(ARCH),)
ifneq ($(ARCH),noarch)
ARCH_SUFFIX = -$(ARCH)-$(TCVERSION)
TC = syno$(ARCH_SUFFIX)
endif
endif

#####

Expand Down
26 changes: 16 additions & 10 deletions mk/spksrc.spk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Most of the rules are imported from spksrc.*.mk files
#
# Variables:
# ARCH A dedicated arch, a generic arch or empty for arch independent packages
# ARCH A dedicated arch, a generic arch or 'noarch' for arch independent packages
# SPK_NAME Package name
# MAINTAINER Package maintainer (mandatory)
# MAINTAINER_URL URL of package maintainer (optional when MAINTAINER is a valid github user)
Expand Down Expand Up @@ -34,6 +34,7 @@ include ../../mk/spksrc.directories.mk
NAME = $(SPK_NAME)

ifneq ($(ARCH),)
ifneq ($(ARCH),noarch)
# arch specific packages
ifneq ($(SPK_PACKAGE_ARCHS),)
SPK_ARCH = $(SPK_PACKAGE_ARCHS)
Expand All @@ -50,11 +51,14 @@ endif
SPK_TCVERS = $(TCVERSION)
ARCH_SUFFIX = -$(ARCH)-$(TCVERSION)
TC = syno$(ARCH_SUFFIX)
else
endif
endif

ifeq ($(ARCH),noarch)
ifneq ($(strip $(TCVERSION)),)
# different noarch packages
SPK_ARCH = noarch
SPK_NAME_ARCH = noarch
ifneq ($(strip $(TCVERSION)),)
ifeq ($(call version_ge, $(TCVERSION), 7.0),1)
SPK_TCVERS = dsm7
TC_OS_MIN_VER = 7.0-40000
Expand All @@ -68,12 +72,9 @@ else
SPK_TCVERS = srm
TC_OS_MIN_VER = 1.1-6931
endif
else
SPK_TCVERS = all
TC_OS_MIN_VER = 3.1-1594
endif
ARCH_SUFFIX = -$(SPK_TCVERS)
endif
endif

ifeq ($(call version_lt, ${TC_OS_MIN_VER}, 6.1)$(call version_ge, ${TC_OS_MIN_VER}, 3.0),11)
OS_MIN_VER = $(TC_OS_MIN_VER)
Expand Down Expand Up @@ -157,9 +158,14 @@ $(WORK_DIR)/INFO:
$(create_target_dir)
@$(MSG) "Creating INFO file for $(SPK_NAME)"
@if [ -z "$(SPK_ARCH)" ]; then \
echo "ERROR: Arch '$(ARCH)' is not a supported architecture" ; \
echo " - There is no remaining arch in '$(TC_ARCH)' for unsupported archs '$(UNSUPPORTED_ARCHS)'"; \
exit 1; \
if [ "$(ARCH)" = "noarch" ]; then \
echo "ERROR: 'noarch' package without TCVERSION is not supported" ; \
exit 1; \
else \
echo "ERROR: Arch '$(ARCH)' is not a supported architecture" ; \
echo " - There is no remaining arch in '$(TC_ARCH)' for unsupported archs '$(UNSUPPORTED_ARCHS)'"; \
exit 1; \
fi; \
fi
@echo package=\"$(SPK_NAME)\" > $@
@echo version=\"$(SPK_VERS)-$(SPK_REV)\" >> $@
Expand Down
11 changes: 11 additions & 0 deletions mk/spksrc.supported.mk
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ $(TARGET_TYPE)-arch-% &: pre-build-native
arch-%:
$(PSTAT_TIME) $(MAKE) $(addprefix build-arch-, $(or $(filter $(addprefix %, $(DEFAULT_TC)), $(filter %$(word 2,$(subst -, ,$*)), $(filter $(firstword $(subst -, ,$*))%, $(AVAILABLE_TOOLCHAINS)))),$*)) | tee --append build-$*.log

noarch-%:
$(PSTAT_TIME) $(MAKE) $(addprefix build-noarch-, $(filter $*, $(AVAILABLE_TCVERSIONS) 3.1)) | tee --append [email protected]

####

build-arch-%: SHELL:=/bin/bash
Expand All @@ -73,4 +76,12 @@ build-arch-%:
$(MSG) $$(date +%Y%m%d-%H%M%S) MAKELEVEL: $(MAKELEVEL), PARALLEL_MAKE: $(PARALLEL_MAKE), ARCH: $*, NAME: $(NAME) [END] >> $(PSTAT_LOG) ; \
[ $${status[0]} -eq 0 ] || false

build-noarch-%: SHELL:=/bin/bash
build-noarch-%:
@$(MSG) BUILDING noarch package for TCVERSION $*
@MAKEFLAGS= $(MAKE) TCVERSION=$* 2>&1 ; \
status=$${PIPESTATUS[0]} ; \
$(MSG) $$(date +%Y%m%d-%H%M%S) MAKELEVEL: $(MAKELEVEL), PARALLEL_MAKE: $(PARALLEL_MAKE), TCVERSION: $*, NAME: $(NAME) [END] >> $(PSTAT_LOG) ; \
[ $${status[0]} -eq 0 ] || false

####
4 changes: 2 additions & 2 deletions spk/adminer/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ WIZARDS_DIR = src/wizard/

POST_STRIP_TARGET = adminer_extra_install

# Pure PHP package, make sure ARCH is not defined
override ARCH=
# Pure PHP package, make sure ARCH is noarch
override ARCH=noarch

include ../../mk/spksrc.spk.mk

Expand Down
4 changes: 2 additions & 2 deletions spk/ariang/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LICENSE = MIT
CONF_DIR = src/conf
STARTABLE = no

# Pure PHP package, make sure ARCH is not defined
override ARCH=
# Pure PHP package, make sure ARCH is noarch
override ARCH=noarch

include ../../mk/spksrc.spk.mk
Loading