Unix.pm 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 makedepprog { $disabled{makedepend} ? undef : $config{makedepprog} }
  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. 1;