Changeset 87
- Timestamp:
- 04/17/07 16:16:29 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/debbuild
r86 r87 78 78 's' => 'Build source' 79 79 ); 80 # Ah, the joys of multiple architectures. :( Feh. 81 # As copied from rpm 82 my %optflags = ( 'i386' => '-O2 -g -march=i386 -mcpu=i686', 83 'amd64' => '-O2 -g' 84 ); 85 my $hostarch; # we set this later... 80 86 my $scriptletbase = 81 87 q(#!/bin/sh … … 83 89 RPM_SOURCE_DIR="%{_topdir}/SOURCES" 84 90 RPM_BUILD_DIR="%{_topdir}/BUILD" 85 RPM_OPT_FLAGS=" -O2 -g -march=i386 -mcpu=i686"86 RPM_ARCH=" i386"91 RPM_OPT_FLAGS="%{optflags}" 92 RPM_ARCH="%{_arch}" 87 93 RPM_OS="linux" 88 94 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS … … 99 105 s/=(.+)/="$1"/; 100 106 $scriptletbase .= " $_"; 107 ($hostarch) = (/^DEB_HOST_ARCH="(.+)"$/) if /DEB_HOST_ARCH/; 101 108 } 102 109 $scriptletbase .= … … 153 160 $pkgdata{$pkg}{name} =~ tr/_/-/; 154 161 155 my $pkgfullname = "$pkgdata{$pkg}{name}_$pkgdata{$pkg}{version}-$pkgdata{main}{release}_ i386.deb";162 my $pkgfullname = "$pkgdata{$pkg}{name}_$pkgdata{$pkg}{version}-$pkgdata{main}{release}_$pkgdata{$pkg}{arch}.deb"; 156 163 157 164 print "$pkgfullname\n" if $filelist{$pkg}; … … 402 409 open SPECFILE,"<$specfile" or die "specfile ($specfile) barfed: $!"; 403 410 411 my $buildarch = $hostarch; 412 404 413 LINE: while (<SPECFILE>) { 405 414 next if /^#/; # Ignore comments... … … 432 441 $pkgdata{$subname}{name} = $subname; 433 442 $pkgdata{$subname}{version} = $pkgdata{main}{version}; 443 # Build "same arch as previous package found" by default. Where rpm just picks the 444 # *very* last one, we want to allow arch<native>+arch-all 445 # (eg, Apache is i386, but apache-manual is all) 446 $pkgdata{$subname}{arch} = $buildarch; # Since it's likely subpackages will NOT have a BuildArch line... 434 447 while (<SPECFILE>) { 435 448 redo LINE if /^\%/; 436 if (my ($dname,$dvalue) = (/^(Summary|Group|Version|Requires|Provides ):\s+(.+)$/i)) {449 if (my ($dname,$dvalue) = (/^(Summary|Group|Version|Requires|Provides|BuildArch(?:itecture)?):\s+(.+)$/i)) { 437 450 $dname =~ tr/[A-Z]/[a-z]/; 451 if ($dname =~ /^BuildArch/i) { 452 $buildarch = $dvalue; # Emulate rpm's behaviour to a degree 453 $dname = 'arch'; 454 } 438 455 $pkgdata{$subname}{$dname} = expandmacros($dvalue, 'gp'); 439 456 } … … 673 690 } 674 691 chomp $pkgdata{main}{$patchname}; 692 } elsif (/^buildarch(?:itecture)?:\s+(.+)/i) { 693 $pkgdata{main}{arch} = $1; 694 $buildarch = $pkgdata{main}{arch}; 675 695 } elsif (/^buildreq(?:uires)?:\s+(.+)/i) { 676 696 $buildreq .= ", $1"; … … 789 809 # Should handle simple subpackages 790 810 sub binpackage { 791 # Make sure we have somewhere to write the .deb file792 if (!-e "$topdir/DEBS/i386") {793 mkdir "$topdir/DEBS/i386";794 }795 811 796 812 foreach my $pkg (@pkglist) { 813 814 $pkgdata{$pkg}{arch} = $hostarch if !$pkgdata{$pkg}{arch}; # Just In Case. 815 $pkgdata{$pkg}{arch} =~ s/^noarch/all/ig; 816 817 # Make sure we have somewhere to write the .deb file 818 if (!-e "$topdir/DEBS/$pkgdata{$pkg}{arch}") { 819 mkdir "$topdir/DEBS/$pkgdata{$pkg}{arch}"; 820 } 797 821 798 822 # Skip building a package if it doesn't actually have any files. NB: This … … 871 895 or die $!; 872 896 print DEBSCRIPT $scriptletbase; 873 print DEBSCRIPT "fakeroot dpkg-deb -b $buildroot/$pkg $topdir/DEBS/ i386/".874 "$pkgdata{$pkg}{name}_$pkgdata{$pkg}{version}-$pkgdata{main}{release}_ i386.deb\n";897 print DEBSCRIPT "fakeroot dpkg-deb -b $buildroot/$pkg $topdir/DEBS/$pkgdata{$pkg}{arch}/". 898 "$pkgdata{$pkg}{name}_$pkgdata{$pkg}{version}-$pkgdata{main}{release}_$pkgdata{$pkg}{arch}.deb\n"; 875 899 # %$&$%@#@@#%@@@ Debian and their horrible ugly package names. >:( 876 900 close DEBSCRIPT; … … 880 904 "Section: $pkgdata{$pkg}{group}\n". 881 905 "Priority: optional\n". 882 "Architecture: i386\n".906 "Architecture: $pkgdata{$pkg}{arch}\n". 883 907 "Maintainer: $pkgdata{main}{packager}\n". 884 908 ( $pkgdata{$pkg}{requires} ne '' ? "Depends: $pkgdata{$pkg}{requires}\n" : '' ). … … 942 966 943 967 $finalmessages .= "Wrote binary package ". 944 "$pkgdata{$pkg}{name}_$pkgdata{$pkg}{version}-$pkgdata{main}{release}_ i386.deb".945 " in $topdir/DEBS/ i386\n";968 "$pkgdata{$pkg}{name}_$pkgdata{$pkg}{version}-$pkgdata{main}{release}_$pkgdata{$pkg}{arch}.deb". 969 " in $topdir/DEBS/$pkgdata{$pkg}{arch}\n"; 946 970 # and clean up 947 971 unlink $debscriptfile; … … 1296 1320 $macrostring =~ s|%{__([a-z0-9_-]+)}|$1|g; 1297 1321 } 1322 1323 # Misc expansions 1324 $macrostring =~ s|%{_arch}|$hostarch|g; 1325 $macrostring =~ s|%{optflags}|$optflags{$hostarch}|g; 1326 1298 1327 } # done with globals section 1299 1328
Note:
See TracChangeset
for help on using the changeset viewer.