- Add a devel package so other modules can be built against this
one. [jira#PED-4964] OBS-URL: https://build.opensuse.org/package/show/X11:Drivers:Video:Redesign/nvidia-open-driver-G06-signed?expand=0&rev=54
This commit is contained in:
parent
07cd135aee
commit
90e23e8ac6
101
group-source-files.pl
Normal file
101
group-source-files.pl
Normal file
@ -0,0 +1,101 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use File::Spec;
|
||||
use Getopt::Long;
|
||||
use strict;
|
||||
|
||||
&main();
|
||||
sub main
|
||||
{
|
||||
my($dev_output, $ndev_output, $loc) = ("-", "-", ".");
|
||||
&Getopt::Long::Configure(qw(bundling));
|
||||
&GetOptions(
|
||||
"D=s" => \$dev_output,
|
||||
"N=s" => \$ndev_output,
|
||||
"L=s" => \$loc,
|
||||
);
|
||||
|
||||
my($dev, $ndev) = &scan($loc);
|
||||
&output($dev, $ndev, $dev_output, $ndev_output);
|
||||
}
|
||||
|
||||
sub scan
|
||||
{
|
||||
# Normalize file path, mainly to strip away the ending forward slash,
|
||||
# or any double forward slashes.
|
||||
my $loc = File::Spec->canonpath(shift @_);
|
||||
# We cannot use an absolute path (e.g. /usr/src/linux-5.14.21-150500.41)
|
||||
# during find because it's under build root, but rpm wants one later.
|
||||
my $abs_loc = rpm_path($loc);
|
||||
my(@dev, @ndev);
|
||||
|
||||
foreach $_ (`find "$loc"`)
|
||||
{
|
||||
chomp $_;
|
||||
if (-d $_ && !-l $_) {
|
||||
# Generate directory list later.
|
||||
next;
|
||||
}
|
||||
my $is_devel =
|
||||
m{^\Q$loc\E.*/Kconfig} ||
|
||||
m{^\Q$loc\E.*/Kbuild} ||
|
||||
m{^\Q$loc\E.*/Makefile} ||
|
||||
m{^\Q$loc\E/arch/[^/]+/boot/dts/include/dt-bindings\b} ||
|
||||
m{^\Q$loc\E/arch/[^/]+/include\b} ||
|
||||
m{^\Q$loc\E/arch/.*/module\.lds\b} ||
|
||||
m{^\Q$loc\E/arch/arm/[^/]+/include/mach\b} ||
|
||||
m{^\Q$loc\E/arch/arm/[^/]+/include/plat\b} ||
|
||||
m{^\Q$loc\E/arch/[^/]+/scripts\b} ||
|
||||
m{^\Q$loc\E/arch/[^/]+/tools\b} ||
|
||||
m{^\Q$loc\E/include/[^/]+\b} ||
|
||||
m{^\Q$loc\E/scripts\b};
|
||||
my $abs_path = rpm_path($_);
|
||||
$is_devel ? push(@dev, $abs_path) : push(@ndev, $abs_path);
|
||||
}
|
||||
|
||||
push(@dev, &calc_dirs($abs_loc, \@dev));
|
||||
push(@ndev, &calc_dirs($abs_loc, \@ndev));
|
||||
return (\@dev, \@ndev);
|
||||
}
|
||||
|
||||
sub calc_dirs
|
||||
{
|
||||
my($base, $files) = @_;
|
||||
my %dirs;
|
||||
|
||||
foreach my $file (@$files) {
|
||||
my ($volume,$path,$basename) = File::Spec->splitpath($file);
|
||||
my @dirs = File::Spec->splitdir($path);
|
||||
do {
|
||||
# Always create $path from catdir() to avoid ending forward slash
|
||||
$path = File::Spec->catdir(@dirs);
|
||||
$dirs{$path} = 1;
|
||||
pop @dirs;
|
||||
} while ($path ne $base);
|
||||
# This loop also makes sure that $base itself is included.
|
||||
}
|
||||
|
||||
return map { "\%dir $_" } keys %dirs;
|
||||
}
|
||||
|
||||
sub output
|
||||
{
|
||||
my($dev, $ndev, $dev_out, $ndev_out) = @_;
|
||||
local *FH;
|
||||
|
||||
open(FH, "> $dev_out") || warn "Error writing to $dev_out: $!";
|
||||
print FH join("\n", @$dev), "\n";
|
||||
close FH;
|
||||
|
||||
open(FH, "> $ndev_out") || warn "Error writing to $ndev_out: $!";
|
||||
print FH join("\n", @$ndev), "\n";
|
||||
close FH;
|
||||
}
|
||||
|
||||
sub rpm_path
|
||||
{
|
||||
my $path = shift @_;
|
||||
# Always prepend forward slash and let canonpath take care of
|
||||
# duplicate forward slashes.
|
||||
return File::Spec->canonpath("/$path");
|
||||
}
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 11 12:48:01 UTC 2023 - Egbert Eich <eich@suse.com>
|
||||
|
||||
- Add a devel package so other modules can be built against this
|
||||
one. [jira#PED-4964]
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 11 11:50:12 UTC 2023 - Stefan Dirsch <sndirsch@suse.com>
|
||||
|
||||
|
@ -52,11 +52,12 @@ Source10: pci_ids-unsupported
|
||||
Source11: pesign-copy-sources
|
||||
Source12: pesign-spec-macros
|
||||
Source13: generati-pci-table.sh
|
||||
Source14: _constraints
|
||||
Source14: group-source-files.pl
|
||||
Patch0: 0001-Don-t-override-INSTALL_MOD_DIR.patch
|
||||
Patch2: persistent-nvidia-id-string.patch
|
||||
Patch3: pci-table.patch
|
||||
BuildRequires: %{kernel_module_package_buildreqs}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: kernel-source
|
||||
BuildRequires: kernel-syms
|
||||
@ -75,6 +76,14 @@ ExclusiveArch: x86_64 aarch64
|
||||
%endif
|
||||
%(sed -e '/^%%post\>/ r %_sourcedir/kmp-post.sh' -e '/^%%postun\>/ r %_sourcedir/kmp-postun.sh' %kmp_template_name >%_builddir/nvidia-kmp-template)
|
||||
%kernel_module_package -n %{name} -t %_builddir/nvidia-kmp-template -f %_sourcedir/kmp-filelist -p %_sourcedir/preamble
|
||||
%{expand:%(
|
||||
for f in %{flavors_to_build}; do \
|
||||
echo "%package -n %{name}-${f}-devel"; \
|
||||
echo "Summary: Devel Package to %name"; \
|
||||
echo "%description -n %{name}-${f}-devel"; \
|
||||
echo "Provide build requiresments to build against %{name}"; \
|
||||
echo "%files -n %{name}-${f}-devel -f files-${f}"; \
|
||||
done)}
|
||||
|
||||
%if ! 0%{hardcode_pci_list}
|
||||
## create hardware supplements for manual builds
|
||||
@ -192,5 +201,12 @@ EOF
|
||||
omit_drivers+=" nvidia nvidia-drm nvidia-modeset nvidia-uvm "
|
||||
EOF
|
||||
done
|
||||
for flavor in %{flavors_to_build}; do
|
||||
mkdir -p %{buildroot}%{_prefix}/src/kernel-modules/nvidia-%{version}-${flavor}
|
||||
cp -r source/kernel-open/* %{buildroot}%{_prefix}/src/kernel-modules/nvidia-%{version}-${flavor}
|
||||
echo %dir %{_prefix}/src/kernel-modules > files-${flavor}
|
||||
perl %{S:14} -L %{buildroot}%{_prefix}/src/kernel-modules/nvidia-%{version}-${flavor} | sed -e "s@%{buildroot}@@" >> files-${flavor}
|
||||
%fdupes -s %{buildroot}%{_prefix}/src/kernel-modules/nvidia-%{version}-${flavor}
|
||||
done
|
||||
|
||||
%changelog
|
||||
|
Loading…
x
Reference in New Issue
Block a user