Currently `buildPerlPackage` prefixes the Perl version to the package's
`pname`, which results in `nix run` not being able to work for any
packages build with it out of the box. This commit corrects that and
phases out the ability to set `name` directly, as well as refactors the
code to not require `cleanedAttrs`.
Because perl packages are prefixed with the perl version, it means that
the `lib.getExe` heuristic will never point to the binary name. So we
provide the meta.mainProgram that overrides that, using the original
pname or parsed name. It's not perfect but should yield better results
already.
`file` is used by the perl script.
```
sub _get_file_type($) {
my $file=shift;
open(FILE, '-|') # handle all filenames safely
|| exec('file', $file)
|| die "can't exec file: $!";
my $type=<FILE>;
close FILE;
return $type;
}
```
This script is very handy to run within a `nix-build` context,
specifically during the fixupPhase.
Unfortunately, file is not propagated, and does not exist causing the
build to fail. Fix it by adding it.
Co-authored-by: Jonathan Ringer <jonringer@users.noreply.github.com>
this takes care of the following folders in pkgs/development:
* arduino
* chez-modules
* go-packages
* guile-modules
* idris-modules
* perl-modules
* r-modules
* ruby-modules
dependencies:
perlPackages.AltCryptRSABigInt: init at 0.06
perlPackages.ConvertASCIIArmour: init at 1.4
perlPackages.CryptCAST5_PP: init at 1.04
perlPackages.CryptDES_EDE3: init at 0.01
perlPackages.CryptDSA: init at 1.17
perlPackages.CryptRIPEMD160: init at 0.06
perlPackages.CryptTwofish: init at 2.17
perlPackages.DataBuffer: init at 0.04
perlPackages.DigestMD2: init at 2.04
perlPackages.MathPrimeUtil: init at 0.73
perlPackages.MathPrimeUtilGMP: init at 0.52
perlPackages.TieEncryptedHash: init at 1.24
Since 2.44_01, the behaviour for `check_lib` in their `Makefile.PL` has
been "fixed" to fail when the `assert_lib` function fails to build the
test.
* 2bc1e90c04
Now, this wouldn't be so bad, since it's good to actually test what
stuff is being compiled against.
Except that *something* is wonky with the cross-compilation build-time
Perl.
```
Undefined subroutine &File::Temp::mktemp called at inc/Devel/CheckLib.pm line 236.
```
As far as I know, this is a built-in function from Perl.
* https://perldoc.perl.org/File/Temp.html
Though, something *else* is wrong with `Checklib.pm`. Side-stepping the
issue by (eww) shelling out to `mktemp`, we get these errors:
```
/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-armv7l-unknown-linux-gnueabihf-binutils-2.31.1/bin/armv7l-unknown-linux-gnueabihf-ld: assertlib_src1_0.553056903257133: file not recognized: file truncated
collect2: error: ld returned 1 exit status
-I/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-expat-2.2.8-armv7l-unknown-linux-gnueabihf-dev/include -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-expat-2.2.8-armv7l-unknown-linux-gnueabihf/lib -lexpat
/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-armv7l-unknown-linux-gnueabihf-binutils-2.31.1/bin/armv7l-unknown-linux-gnueabihf-ld: assertlib_src2_0.262169388446154: file not recognized: file truncated
collect2: error: ld returned 1 exit status
Can't link/include C library 'expat.h', 'expat', aborting.
```
Meanwhile, the actual build, while building the library, seemingly has
no issues building using those paths. `¯\_(ツ)_/¯`