!3 support srcpath option for build
From: @zhang-yao-2022 Reviewed-by: @dillon_chen Signed-off-by: @dillon_chen
This commit is contained in:
commit
ad9bf97a1c
@ -1,16 +1,17 @@
|
|||||||
%define debug_package %{nil}
|
|
||||||
%define perl_version 5.34.0
|
%define perl_version 5.34.0
|
||||||
|
|
||||||
Name: relocatable-perl
|
Name: relocatable-perl
|
||||||
Version: %{perl_version}.0
|
Version: %{perl_version}.0
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: self-contained, portable perl binaries
|
Summary: self-contained, portable perl binaries
|
||||||
License: Artistic-1.0 and GPL-1.0-or-later
|
License: Artistic-1.0 and GPL-1.0-or-later
|
||||||
URL: https://github.com/skaji/%{name}/
|
URL: https://github.com/skaji/%{name}/
|
||||||
Source0: https://github.com/skaji/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
|
Source0: https://github.com/skaji/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
|
||||||
|
|
||||||
|
Patch0001: support-srcpath-option-for-build.patch
|
||||||
|
|
||||||
BuildRequires: make perl-Devel-PatchPerl perl-File-pushd perl-Module-Pluggable perl-IPC-Run3
|
BuildRequires: make perl-Devel-PatchPerl perl-File-pushd perl-Module-Pluggable perl-IPC-Run3
|
||||||
BuildRequires: perl-App-ChangeShebang
|
BuildRequires: perl-App-ChangeShebang bzip2-devel zlib-devel
|
||||||
|
|
||||||
%description
|
%description
|
||||||
self-contained, portable perl binaries
|
self-contained, portable perl binaries
|
||||||
@ -22,27 +23,36 @@ mkdir -p %{_builddir}/perl.src/
|
|||||||
pushd %{_builddir}/perl.src
|
pushd %{_builddir}/perl.src
|
||||||
yumdownloader --source perl
|
yumdownloader --source perl
|
||||||
rpm2cpio perl-%{perl_version}*.src.rpm | cpio -div
|
rpm2cpio perl-%{perl_version}*.src.rpm | cpio -div
|
||||||
|
rpmbuild -bp -D "_sourcedir %{_builddir}/perl.src" perl.spec
|
||||||
|
cp -rf %{_builddir}/perl-%{perl_version}/* %{_builddir}/%{name}-%{version}
|
||||||
|
cp -R %{_builddir}/perl-%{perl_version}/. %{_builddir}/%{name}-%{version}
|
||||||
popd
|
popd
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
BUILD_BZIP2=0
|
||||||
|
BZIP2_LIB=%{_libdir}
|
||||||
|
export BUILD_BZIP2 BZIP2_LIB
|
||||||
# close darwin and close remote download
|
# close darwin and close remote download
|
||||||
sed -i "s/^use Devel::PatchPerl::Plugin::FixCompoundTokenSplitByMacro;/# &/" build/relocatable-perl-build
|
sed -i "s/^use Devel::PatchPerl::Plugin::FixCompoundTokenSplitByMacro;/# &/" build/relocatable-perl-build
|
||||||
sed -i "s/^use CPAN::Perl::Releases::MetaCPAN 'perl_tarballs';/# &/" build/relocatable-perl-build
|
sed -i "s/^use CPAN::Perl::Releases::MetaCPAN 'perl_tarballs';/# &/" build/relocatable-perl-build
|
||||||
sed -i "s/^use HTTP::Tinyish;/# &/" build/relocatable-perl-build
|
sed -i "s/^use HTTP::Tinyish;/# &/" build/relocatable-perl-build
|
||||||
%{__perl} build/relocatable-perl-build --prefix %{_builddir}/%{name}-%{version} --tarball %{_builddir}/perl.src/perl-%{perl_version}.tar.xz
|
%{__perl} build/relocatable-perl-build --prefix %{_builddir}/%{name}-%{version} --srcpath %{_builddir}/%{name}-%{version} --perl_version perl-%{perl_version}
|
||||||
|
|
||||||
%install
|
%install
|
||||||
mkdir -p %{buildroot}%{_bindir}
|
mkdir -p %{buildroot}%{_bindir}
|
||||||
mkdir -p %{buildroot}%{_libdir}
|
mkdir -p %{buildroot}%{_libdir}
|
||||||
change-shebang -f bin/*
|
change-shebang -f bin/*
|
||||||
%{_fixperms} lib/*
|
%{_fixperms} lib64/*
|
||||||
cp -apr bin/* %{buildroot}%{_bindir}
|
cp -apr bin/* %{buildroot}%{_bindir}
|
||||||
cp -apr lib/* %{buildroot}%{_libdir}
|
cp -apr lib64/* %{buildroot}%{_libdir}
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%{_bindir}/*
|
%{_bindir}/*
|
||||||
%{_libdir}/*
|
%{_libdir}/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon May 12 2025 zhangyao <zhangyao108@huawei.com> - 5.34.0.0-2
|
||||||
|
- support srcpath option for build
|
||||||
|
|
||||||
* Mon Apr 07 2025 xinghe <xinghe2@h-partners.com> - 5.34.0.0-1
|
* Mon Apr 07 2025 xinghe <xinghe2@h-partners.com> - 5.34.0.0-1
|
||||||
- Init package
|
- Init package
|
||||||
|
|||||||
106
support-srcpath-option-for-build.patch
Normal file
106
support-srcpath-option-for-build.patch
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
From d847354f4a0a0e2450e559e162257b096bc53973 Mon Sep 17 00:00:00 2001
|
||||||
|
From: zhangyao <zhangyao108@huawei.com>
|
||||||
|
Date: Fri, 25 Apr 2025 16:05:43 +0800
|
||||||
|
Subject: [PATCH] support srcpath option for build
|
||||||
|
|
||||||
|
---
|
||||||
|
build/relocatable-perl-build | 27 +++++++++++++++++++++------
|
||||||
|
1 file changed, 21 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/build/relocatable-perl-build b/build/relocatable-perl-build
|
||||||
|
index 0b2f6b2..22bfbba 100644
|
||||||
|
--- a/build/relocatable-perl-build
|
||||||
|
+++ b/build/relocatable-perl-build
|
||||||
|
@@ -51,6 +51,7 @@ relocatable-perl-build - building perl with relocatable settings
|
||||||
|
--perl_version install perl version
|
||||||
|
--tarball use local tar.gz
|
||||||
|
--jobs parallel build, default: 1
|
||||||
|
+ --srcpath use local perl source path
|
||||||
|
--help, -h show this help message
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
@@ -68,6 +69,7 @@ GetOptions
|
||||||
|
"prefix=s" => \(my $prefix),
|
||||||
|
"perl_version=s" => \(my $perl_version),
|
||||||
|
"tarball=s" => \(my $tarball),
|
||||||
|
+ "srcpath=s" => \(my $srcpath),
|
||||||
|
"jobs=i" => \(my $jobs),
|
||||||
|
"help|h" => sub { pod2usage(0) },
|
||||||
|
or pod2usage(1);
|
||||||
|
@@ -75,6 +77,8 @@ or pod2usage(1);
|
||||||
|
$prefix or do { warn "prefix option is required.\n"; pod2usage(1) };
|
||||||
|
if ($tarball && $tarball =~ /5\.(\d+)\.(\d+)/) {
|
||||||
|
$perl_version = "5.$1.$2";
|
||||||
|
+} elsif ($perl_version && $perl_version =~ /5\.(\d+)\.(\d+)/) {
|
||||||
|
+ $perl_version = "5.$1.$2";
|
||||||
|
}
|
||||||
|
$perl_version or do { warn "perl_verion option is required.\n"; pod2usage(1) };
|
||||||
|
|
||||||
|
@@ -84,7 +88,7 @@ if (!-d $prefix) {
|
||||||
|
die "don't have write permission to $prefix\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
-perl_build($prefix, $perl_version, $tarball);
|
||||||
|
+perl_build($prefix, $perl_version, $tarball, $srcpath);
|
||||||
|
force_symlink($prefix, $perl_version);
|
||||||
|
|
||||||
|
my $config_heavy = `$prefix/bin/perldoc -lm Config_heavy.pl`;
|
||||||
|
@@ -103,7 +107,7 @@ system "$prefix/bin/perl -V";
|
||||||
|
exit;
|
||||||
|
|
||||||
|
sub perl_build {
|
||||||
|
- my ($prefix, $perl_version, $tarball) = @_;
|
||||||
|
+ my ($prefix, $perl_version, $tarball, $srcpath) = @_;
|
||||||
|
|
||||||
|
my $current_dir = getcwd;
|
||||||
|
|
||||||
|
@@ -113,7 +117,10 @@ sub perl_build {
|
||||||
|
mkdir $tempdir or die "mkdir $tempdir: $!\n";
|
||||||
|
|
||||||
|
my %tar_option = ("tar.gz" => "xzf", "tar.bz2" => "xjf", "tar.xz" => "xJf");
|
||||||
|
- if ($tarball) {
|
||||||
|
+ if ($srcpath) {
|
||||||
|
+ say "---> use $srcpath";
|
||||||
|
+ $tempdir = $srcpath;
|
||||||
|
+ } elsif ($tarball) {
|
||||||
|
say "---> use $tarball";
|
||||||
|
my ($suffix) = $tarball =~ /\.(tar\.(?:gz|bz2|xz))$/;
|
||||||
|
run ["tar", $tar_option{$suffix}, $tarball, "-C", $tempdir], $log;
|
||||||
|
@@ -136,6 +143,8 @@ sub perl_build {
|
||||||
|
"-Dman1dir=none",
|
||||||
|
"-Dman3dir=none",
|
||||||
|
"-DDEBUGGING=-g",
|
||||||
|
+ "-Dusethreads",
|
||||||
|
+ "-Duseithreads",
|
||||||
|
);
|
||||||
|
if ($Config{archname} =~ /linux/i) {
|
||||||
|
# ubuntu 18.04 does not have xlocale.h
|
||||||
|
@@ -150,16 +159,22 @@ sub perl_build {
|
||||||
|
}
|
||||||
|
push @Configure, "-des";
|
||||||
|
|
||||||
|
- chdir "$tempdir/perl-$perl_version" or die;
|
||||||
|
+ if ($srcpath) {
|
||||||
|
+ chdir "$tempdir" or die;
|
||||||
|
+ } else {
|
||||||
|
+ chdir "$tempdir/perl-$perl_version" or die;
|
||||||
|
+ }
|
||||||
|
my $devel = "Devel::PatchPerl";
|
||||||
|
say "---> patching by $devel " . $devel->VERSION;
|
||||||
|
$devel->patch_source($perl_version, ".");
|
||||||
|
say "---> building perl $perl_version, see $log for progress";
|
||||||
|
run \@Configure, $log;
|
||||||
|
my @option = $jobs ? ("--jobs=$jobs") : ();
|
||||||
|
- run ["make", @option, "install"], $log;
|
||||||
|
+ run ["make", @option, "install"];
|
||||||
|
chdir $current_dir;
|
||||||
|
- rmtree $tempdir;
|
||||||
|
+ if (!$srcpath) {
|
||||||
|
+ rmtree $tempdir;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
sub patch_config_heavy {
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user