Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

Commit

Permalink
(maint) only force libxml2/libxslt internal mirror if necessary
Browse files Browse the repository at this point in the history
autotools version patch required to support building on EL8
era operating systems and older.
  • Loading branch information
h0tw1r3 committed Feb 13, 2024
1 parent 6ceb045 commit e31da0c
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 17 deletions.
43 changes: 35 additions & 8 deletions configs/components/libxml2.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
component "libxml2" do |pkg, settings, platform|
pkg.version '2.10.3'
pkg.sha256sum '26d2415e1c23e0aad8ca52358523fc9116a2eb6e4d4ef47577b1635c7cee3d5f'
pkg.url "#{settings[:buildsources_url]}/libxml2-#{pkg.get_version}.tar.gz"

# Newer versions of libxml2 either ship as tar.xz or do not ship with a configure file
# and require a newer version of GNU Autotools to generate. This causes problems with
# the older and esoteric (AIX, Solaris) platforms that we support.
# So we generate a configure file manually, compress as tar.gz, and host internally.
pkg.sha256sum '497f12e34790d407ec9e2a190d576c0881a1cd78ff3c8991d1f9e40281a5ff57'
pkg.url "https://gitlab.gnome.org/GNOME/libxml2/-/archive/v#{pkg.get_version}/libxml2-v#{pkg.get_version}.tar.gz"

if platform.is_aix?
if platform.name == 'aix-7.1-ppc'
Expand All @@ -23,6 +18,7 @@
pkg.environment "CFLAGS", "#{settings[:cflags]} -std=c99"
pkg.environment "LDFLAGS", settings[:ldflags]
elsif platform.is_macos?
pkg.environment 'PATH', '$(PATH):/opt/homebrew/bin:/usr/local/bin'
pkg.environment "LDFLAGS", settings[:ldflags]
pkg.environment "CFLAGS", settings[:cflags]
if platform.is_cross_compiled?
Expand All @@ -34,7 +30,38 @@
pkg.environment "CFLAGS", settings[:cflags]
end

pkg.build_requires "runtime-#{settings[:runtime_project]}"
build_deps = [ "runtime-#{settings[:runtime_project]}" ]

if platform.is_sles?
build_deps << "autoconf"
elsif platform.is_deb? || platform.is_rpm?
build_deps << "dh-autoreconf"
end

if platform.name == 'el-8-x86_64' || platform.name == 'el-9-x86_64'
build_deps.reject! { |r| r == 'dh-autoreconf' }
end

build_deps.each do |dep|
pkg.build_requires dep
end

# Newer versions of libxml2 either ship as tar.xz or do not ship with a configure file
# and require a newer version of GNU Autotools to generate. This causes problems with
# the older and esoteric (AIX, Solaris) platforms that we support.
# So we generate a configure file manually, compress as tar.gz, and host internally.
if (platform.is_aix? && platform.name == 'aix-7.1-ppc') || platform.is_solaris?
pkg.url "#{settings[:buildsources_url]}/libxml2-#{pkg.get_version}-puppet.tar.gz"
pkg.sha256sum '26d2415e1c23e0aad8ca52358523fc9116a2eb6e4d4ef47577b1635c7cee3d5f'
else
pkg.mirror "#{settings[:buildsources_url]}/libxml2-#{pkg.get_version}.tar.gz"
# Patch downgrades autotools requirement from 1.16.3 to 1.15
# EL8 era distros and older do not support 1.16.3.
# Vendor only required it to fix a python 3.10 detection bug,
# 1.15 works just fine for our build.
pkg.apply_patch 'resources/patches/libxml2/configure.ac.patch'
pkg.configure { ["autoreconf --force --install"] }
end

pkg.configure do
["./configure --prefix=#{settings[:prefix]} --without-python #{settings[:host]}"]
Expand Down
45 changes: 36 additions & 9 deletions configs/components/libxslt.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
component "libxslt" do |pkg, settings, platform|
pkg.version '1.1.37'
pkg.sha256sum 'a4ecab265f44e888ed3b39e11c7e925103ef6e26e09d62e9381f26977df96343'
pkg.url "#{settings[:buildsources_url]}/libxslt-v#{pkg.get_version}.tar.gz"

# Newer versions of libxslt either ship as tar.xz or do not ship with a configure file
# and require a newer version of GNU Autotools to generate. This causes problems with
# the older and esoteric (AIX, Solaris) platforms that we support.
# So we generate a configure file manually, compress as tar.gz, and host internally.

pkg.build_requires "libxml2"
pkg.sha256sum 'b6f96869b8c42e8257b19d633d31e38cf12ff770829352a9dd109795ffc78bf2'
pkg.url "https://gitlab.gnome.org/GNOME/libxslt/-/archive/v#{pkg.get_version}/libxslt-v#{pkg.get_version}.tar.gz"

if platform.is_aix?
if platform.name == 'aix-7.1-ppc'
Expand All @@ -34,13 +27,47 @@
pkg.environment 'CC', 'clang -target arm64-apple-macos11' if platform.name =~ /osx-11/
pkg.environment 'CC', 'clang -target arm64-apple-macos12' if platform.name =~ /osx-12/
end
pkg.environment 'PATH', '$(PATH):/opt/homebrew/bin:/usr/local/bin'
pkg.environment "LDFLAGS", settings[:ldflags]
pkg.environment "CFLAGS", settings[:cflags]
else
pkg.environment "LDFLAGS", settings[:ldflags]
pkg.environment "CFLAGS", settings[:cflags]
end

build_deps = [ "libxml2" ]

if platform.is_sles?
build_deps << "autoconf"
elsif platform.is_deb? || platform.is_rpm?
build_deps << "dh-autoreconf"
end

if platform.name == 'el-8-x86_64' || platform.name == 'el-9-x86_64'
build_deps.reject! { |r| r == 'dh-autoreconf' }
end

build_deps.each do |dep|
pkg.build_requires dep
end

# Newer versions of libxslt either ship as tar.xz or do not ship with a configure file
# and require a newer version of GNU Autotools to generate. This causes problems with
# the older and esoteric (AIX, Solaris) platforms that we support.
# So we generate a configure file manually, compress as tar.gz, and host internally.
if (platform.is_aix? && platform.name == 'aix-7.1-ppc') || platform.is_solaris?
pkg.url "#{settings[:buildsources_url]}/libxslt-v#{pkg.get_version}-puppet.tar.gz"
pkg.sha256sum 'a4ecab265f44e888ed3b39e11c7e925103ef6e26e09d62e9381f26977df96343'
else
pkg.mirror "#{settings[:buildsources_url]}/libxslt-v#{pkg.get_version}.tar.gz"
# Patch downgrades autotools requirement from 1.16.3 to 1.15
# EL8 era distros and older do not support 1.16.3.
# Vendor only required it to fix a python 3.10 detection bug,
# 1.15 works just fine for our build.
pkg.apply_patch 'resources/patches/libxslt/configure.ac.patch'
pkg.configure { ["autoreconf --force --install"] }
end

pkg.configure do
["./configure --without-python --prefix=#{settings[:prefix]} --docdir=/tmp --with-libxml-prefix=#{settings[:prefix]} #{settings[:host]} #{disable_crypto} #{build}"]
end
Expand Down
11 changes: 11 additions & 0 deletions resources/patches/libxml2/configure.ac.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/configure.ac 2024-02-13 20:48:04.340733431 +0000
+++ b/configure.ac 2024-02-13 20:47:55.056533429 +0000
@@ -39,7 +39,7 @@

VERSION=${LIBXML_VERSION}

-AM_INIT_AUTOMAKE([1.16.3 foreign no-dist-gzip dist-xz])
+AM_INIT_AUTOMAKE([1.15 foreign no-dist-gzip dist-xz])
AM_MAINTAINER_MODE([enable])
AM_SILENT_RULES([yes])

11 changes: 11 additions & 0 deletions resources/patches/libxslt/configure.ac.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/configure.ac 2024-02-13 20:45:38.453590684 +0000
+++ b/configure.ac 2024-02-13 20:45:16.549118812 +0000
@@ -67,7 +67,7 @@
AC_SUBST(LIBEXSLT_VERSION_NUMBER)
AC_SUBST(LIBEXSLT_VERSION_EXTRA)

-AM_INIT_AUTOMAKE([1.16.3 foreign no-dist-gzip dist-xz])
+AM_INIT_AUTOMAKE([1.15 foreign no-dist-gzip dist-xz])
AM_MAINTAINER_MODE([enable])
AM_SILENT_RULES([yes])

0 comments on commit e31da0c

Please sign in to comment.