summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCzarek Nakamoto <cyjan@mrcyjanek.net>2025-07-09 23:52:19 +0200
committerCzarek Nakamoto <cyjan@mrcyjanek.net>2025-07-09 23:52:19 +0200
commit97bd91caf41178d28846b4cb6755777bb21a17dc (patch)
tree7e9945cd47fd281c181af2aabc91ab56d44832a9
parenta27fbcb24d91143715ed930a05aaa4d853fba1f2 (diff)
feat: jenkins CI initial
-rw-r--r--contrib/depends/Jenkinsfile94
-rw-r--r--contrib/depends/funcs.mk49
2 files changed, 134 insertions, 9 deletions
diff --git a/contrib/depends/Jenkinsfile b/contrib/depends/Jenkinsfile
new file mode 100644
index 0000000..91313e8
--- /dev/null
+++ b/contrib/depends/Jenkinsfile
@@ -0,0 +1,94 @@
+pipeline {
+ agent none
+
+ parameters {
+ string(
+ name: 'LINUX_TARGETS',
+ defaultValue: 'x86_64-linux-android,armv7a-linux-androideabi,aarch64-linux-android,x86_64-linux-gnu,aarch64-linux-gnu,i686-linux-gnu,x86_64-w64-mingw32,i686-w64-mingw32',
+ description: 'Comma-separated list of Linux targets to build'
+ )
+ string(
+ name: 'DARWIN_TARGETS',
+ defaultValue: 'aarch64-apple-darwin,x86_64-apple-darwin,aarch64-apple-ios,aarch64-apple-iossimulator',
+ description: 'Comma-separated list of Darwin targets to build'
+ )
+ }
+
+ stages {
+ stage('Build Dependencies') {
+ parallel {
+ stage('Linux Builds') {
+ agent {
+ dockerfile {
+ filename '.devcontainer/Dockerfile'
+ args '-v /opt/builds:/opt/builds'
+ label 'linux && amd64'
+ }
+ }
+ steps {
+ script {
+ def targets = params.LINUX_TARGETS.split(',').collect { it.trim() }
+
+ checkout scm
+
+ for (target in targets) {
+ echo "Building dependencies for ${target}"
+
+ dir('contrib/depends') {
+ sh "make HOST=${target}"
+ }
+ }
+ }
+ }
+ post {
+ always {
+ script {
+ def targets = params.LINUX_TARGETS.split(',').collect { it.trim() }
+ for (target in targets) {
+ archiveArtifacts artifacts: "contrib/depends/built/${target}/*/*.tar.gz*", allowEmptyArchive: true
+ }
+ }
+ }
+ }
+ }
+
+ stage('Darwin Builds') {
+ agent {
+ label 'darwin && arm64'
+ }
+ steps {
+ script {
+ def targets = params.DARWIN_TARGETS.split(',').collect { it.trim() }
+
+ checkout scm
+
+ for (target in targets) {
+ echo "Building dependencies for ${target}"
+
+ dir('contrib/depends') {
+ sh "make HOST=${target}"
+ }
+ }
+ }
+ }
+ post {
+ always {
+ script {
+ def targets = params.DARWIN_TARGETS.split(',').collect { it.trim() }
+ for (target in targets) {
+ archiveArtifacts artifacts: "contrib/depends/built/${target}/*/*.tar.gz*", allowEmptyArchive: true
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ post {
+ always {
+ echo "Build completed."
+ }
+ }
+} \ No newline at end of file
diff --git a/contrib/depends/funcs.mk b/contrib/depends/funcs.mk
index 70b592f..33dd301 100644
--- a/contrib/depends/funcs.mk
+++ b/contrib/depends/funcs.mk
@@ -36,7 +36,7 @@ define fetch_file
endef
define int_get_build_recipe_hash
-$(eval $(1)_all_file_checksums:=$(shell $(build_SHA256SUM) $(meta_depends) packages/$(1).mk $(addprefix $(PATCHES_PATH)/$(1)/,$($(1)_patches)) | cut -d" " -f1))
+$(eval $(1)_all_file_checksums:=$(shell cd $(BASEDIR) && $(build_SHA256SUM) $(subst $(BASEDIR)/,,$(meta_depends)) packages/$(1).mk $(addprefix patches/$(1)/,$($(1)_patches)) 2>/dev/null | cut -d" " -f1))
$(eval $(1)_recipe_hash:=$(shell echo -n "$($(1)_all_file_checksums)" | $(build_SHA256SUM) | cut -d" " -f1))
endef
@@ -198,53 +198,84 @@ COMPRESS_CMD := $(shell if command -v pigz >/dev/null 2>&1; then echo "pigz"; el
define int_add_cmds
$($(1)_fetched):
+ $(AT)echo "=== Fetching $(1) v$($(1)_version) ==="
+ $(AT)echo " Source directory: $($(1)_source_dir)"
+ $(AT)echo " Download file: $($(1)_download_file)"
$(AT)mkdir -p $$(@D) $(SOURCES_PATH)
$(AT)rm -f $$@
$(AT)touch $$@
$(AT)cd $$(@D); $(call $(1)_fetch_cmds,$(1))
$(AT)cd $($(1)_source_dir); $(foreach source,$($(1)_all_sources),$(build_SHA256SUM) $(source) >> $$(@);)
+ $(AT)echo " Fetch completed: $$@"
$(AT)touch $$@
$($(1)_extracted): | $($(1)_fetched)
- $(AT)echo Extracting $(1)...
+ $(AT)echo "=== Extracting $(1) v$($(1)_version) ==="
+ $(AT)echo " Build ID: $($(1)_build_id)"
+ $(AT)echo " Extract directory: $($(1)_extract_dir)"
$(AT)mkdir -p $$(@D)
$(AT)cd $$(@D); $(call $(1)_extract_cmds,$(1))
+ $(AT)echo " Extract completed: $$@"
$(AT)touch $$@
$($(1)_preprocessed): | $($(1)_dependencies) $($(1)_extracted)
- $(AT)echo Preprocessing $(1)...
+ $(AT)echo "=== Preprocessing $(1) v$($(1)_version) ==="
+ $(AT)echo " Dependencies: $($(1)_dependencies)"
+ $(AT)echo " Patch directory: $($(1)_patch_dir)"
+ $(AT)echo " Patches: $($(1)_patches)"
$(AT)mkdir -p $$(@D) $($(1)_patch_dir)
$(AT)$(foreach patch,$($(1)_patches),cd $(PATCHES_PATH)/$(1); cp $(patch) $($(1)_patch_dir) ;)
$(AT)cd $$(@D); $(call $(1)_preprocess_cmds, $(1))
+ $(AT)echo " Preprocessing completed: $$@"
$(AT)touch $$@
$($(1)_configured): | $($(1)_preprocessed)
- $(AT)echo Configuring $(1)...
+ $(AT)echo "=== Configuring $(1) v$($(1)_version) ==="
+ $(AT)echo " Build directory: $($(1)_build_dir)"
+ $(AT)echo " Host prefix: $(host_prefix)"
+ $(AT)echo " All dependencies: $($(1)_all_dependencies)"
$(AT)rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), tar xf $($(package)_cached); )
$(AT)mkdir -p $$(@D)
$(AT)+cd $$(@D); $($(1)_config_env) $(call $(1)_config_cmds, $(1))
+ $(AT)echo " Configuration completed: $$@"
$(AT)touch $$@
$($(1)_built): | $($(1)_configured)
- $(AT)echo Building $(1)...
+ $(AT)echo "=== Building $(1) v$($(1)_version) ==="
+ $(AT)echo " Build directory: $($(1)_build_dir)"
+ $(AT)echo " Build environment: $($(1)_build_env)"
$(AT)mkdir -p $$(@D)
$(AT)+cd $$(@D); $($(1)_build_env) $(call $(1)_build_cmds, $(1))
+ $(AT)echo " Build completed: $$@"
$(AT)touch $$@
$($(1)_staged): | $($(1)_built)
- $(AT)echo Staging $(1)...
+ $(AT)echo "=== Staging $(1) v$($(1)_version) ==="
+ $(AT)echo " Staging directory: $($(1)_staging_dir)"
+ $(AT)echo " Staging prefix: $($(1)_staging_prefix_dir)"
$(AT)mkdir -p $($(1)_staging_dir)/$(host_prefix)
$(AT)cd $($(1)_build_dir); $($(1)_stage_env) $(call $(1)_stage_cmds, $(1))
+ $(AT)echo " Removing extract directory: $($(1)_extract_dir)"
$(AT)rm -rf $($(1)_extract_dir)
+ $(AT)echo " Staging completed: $$@"
$(AT)touch $$@
$($(1)_postprocessed): | $($(1)_staged)
- $(AT)echo Postprocessing $(1)...
+ $(AT)echo "=== Postprocessing $(1) v$($(1)_version) ==="
+ $(AT)echo " Postprocessing directory: $($(1)_staging_prefix_dir)"
$(AT)cd $($(1)_staging_prefix_dir); $(call $(1)_postprocess_cmds)
+ $(AT)echo " Postprocessing completed: $$@"
$(AT)touch $$@
$($(1)_cached): | $($(1)_dependencies) $($(1)_postprocessed)
- $(AT)echo Caching $(1)...
+ $(AT)echo "=== Caching $(1) v$($(1)_version) ==="
+ $(AT)echo " Build ID: $($(1)_build_id)"
+ $(AT)echo " Cache file: $$@"
+ $(AT)echo " Compression: $(COMPRESS_CMD)"
$(AT)cd $$($(1)_staging_dir)/$(host_prefix); find . | sort | tar --no-recursion --use-compress-program='$(COMPRESS_CMD)' -cf $$($(1)_staging_dir)/$$(@F) -T -
$(AT)mkdir -p $$(@D)
- $(AT)rm -rf $$(@D) && mkdir -p $$(@D)
$(AT)mv $$($(1)_staging_dir)/$$(@F) $$(@)
+ $(AT)echo " Removing staging directory: $($(1)_staging_dir)"
$(AT)rm -rf $($(1)_staging_dir)
+ $(AT)echo " Caching completed: $$@"
$($(1)_cached_checksum): $($(1)_cached)
+ $(AT)echo "=== Generating checksum for $(1) v$($(1)_version) ==="
+ $(AT)echo " Checksum file: $$@"
$(AT)cd $$(@D); $(build_SHA256SUM) $$(<F) > $$(@)
+ $(AT)echo " Checksum completed: $$@"
.PHONY: $(1)
$(1): | $($(1)_cached_checksum)