Unix.pm 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package platform::Unix;
  2. use strict;
  3. use warnings;
  4. use Carp;
  5. use vars qw(@ISA);
  6. require platform::BASE;
  7. @ISA = qw(platform::BASE);
  8. # Assume someone set @INC right before loading this module
  9. use configdata;
  10. sub binext { $target{exe_extension} || '' }
  11. sub dsoext { $target{dso_extension} || platform->shlibextsimple()
  12. || '.so' }
  13. # Because these are also used in scripts and not just Makefile, we must
  14. # convert $(SHLIB_VERSION_NUMBER) to the actual number.
  15. sub shlibext { (my $x = $target{shared_extension}
  16. || '.so.$(SHLIB_VERSION_NUMBER)')
  17. =~ s|\.\$\(SHLIB_VERSION_NUMBER\)
  18. |.$config{shlib_version}|x;
  19. $x; }
  20. sub libext { $target{lib_extension} || '.a' }
  21. sub defext { $target{def_extension} || '.ld' }
  22. sub objext { $target{obj_extension} || '.o' }
  23. sub depext { $target{obj_extension} || '.d' }
  24. # Other extra that aren't defined in platform::BASE
  25. sub shlibextsimple { (my $x = $target{shared_extension} || '.so')
  26. =~ s|\.\$\(SHLIB_VERSION_NUMBER\)||;
  27. $x; }
  28. sub shlibvariant { $target{shlib_variant} || "" }
  29. sub makedepcmd { $disabled{makedepend} ? undef : $config{makedepcmd} }
  30. # No conversion of assembler extension on Unix
  31. sub asm {
  32. return $_[1];
  33. }
  34. # At some point, we might decide that static libraries are called something
  35. # other than the default...
  36. sub staticname {
  37. # Non-installed libraries are *always* static, and their names remain
  38. # the same, except for the mandatory extension
  39. my $in_libname = platform::BASE->staticname($_[1]);
  40. return $in_libname if $unified_info{attributes}->{$_[1]}->{noinst};
  41. # We currently return the same name anyway... but we might choose to
  42. # append '_static' or '_a' some time in the future.
  43. return platform::BASE->staticname($_[1]);
  44. }
  45. sub sharedname {
  46. return platform::BASE::__concat(platform::BASE->sharedname($_[1]),
  47. ($_[0]->shlibvariant() // ''));
  48. }
  49. sub sharedname_simple {
  50. return platform::BASE::__isshared($_[1]) ? $_[1] : undef;
  51. }
  52. sub sharedlib_simple {
  53. return platform::BASE::__concat($_[0]->sharedname_simple($_[1]),
  54. $_[0]->shlibextsimple());
  55. }
  56. sub sharedlib_import {
  57. return undef;
  58. }
  59. 1;