actions.py 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Licensed under the GNU General Public License, version 3.
  5. # See the file http://www.gnu.org/licenses/gpl.txt
  6. from inary.actionsapi import get
  7. from inary.actionsapi import autotools
  8. from inary.actionsapi import inarytools
  9. from inary.actionsapi import shelltools
  10. def builddiet():
  11. inarytools.flags.add("-fno-lto")
  12. shelltools.export("LIBS","-lpthread -luuid")
  13. dietCC = "diet %s %s %s -Os -static" % (get.CC(), get.CFLAGS(), get.LDFLAGS())
  14. #dietCC = "%s %s %s -Os -static" % (get.CC(), get.CFLAGS(), get.LDFLAGS())
  15. shelltools.export("CC", dietCC)
  16. autotools.make("distclean")
  17. autotools.autoreconf("-fi")
  18. autotools.configure('--with-thin-check= \
  19. --with-thin-dump= \
  20. --with-thin-repair= \
  21. --with-thin-restore= \
  22. --with-cache-check= \
  23. --with-cache-dump= \
  24. --with-cache-repair= \
  25. --with-cache-restore= \
  26. ac_cv_lib_dl_dlopen=no \
  27. --with-staticdir="/sbin" \
  28. --enable-debug \
  29. --with-optimisation=\"%s -Os\" \
  30. --enable-static_link \
  31. --with-lvm1=internal \
  32. --disable-readline \
  33. --disable-nls \
  34. --disable-selinux \
  35. --with-confdir=/etc \
  36. --enable-applib \
  37. --enable-cmdlib \
  38. --enable-pkgconfig \
  39. --enable-udev_rules \
  40. --with-systemdsystemunitdir=no \
  41. --enable-udev_sync' % get.CFLAGS())
  42. #inarytools.dosed("lib/misc/configure.h","rpl_malloc","malloc")
  43. #inarytools.dosed("lib/misc/configure.h","rpl_realloc","realloc")
  44. autotools.make("-j1 -C include")
  45. autotools.make("-j1 -C lib LIB_SHARED= VERSIONED_SHLIB=")
  46. autotools.make("-j1 -C libdm LIB_SHARED= VERSIONED_SHLIB=")
  47. autotools.make("-j1 -C tools install_dmsetup_dynamic")
  48. autotools.make("-j1 -C udev install")
  49. autotools.make("-j1 -C libdaemon LIB_SHARED= VERSIONED_SHLIB=")
  50. autotools.make("-j1 -C tools dmsetup.static lvm.static DIETLIBC_LIBS=\"-lcompat\"")
  51. inarytools.insinto("/usr/lib/dietlibc/lib-i386", "libdm/ioctl/libdevmapper.a")
  52. inarytools.insinto("/sbin/", "tools/lvm.static")
  53. inarytools.insinto("/sbin/", "tools/dmsetup.static")
  54. def setup():
  55. # Breaks linking when sandbox is disabled
  56. shelltools.export("CLDFLAGS", get.LDFLAGS())
  57. shelltools.export("LIB_PTHREAD", "-lpthread")
  58. inarytools.dosed("conf/example.conf.in", "use_lvmetad = 0", "use_lvmetad = 1")
  59. autotools.autoreconf("-fi")
  60. autotools.configure("--with-thin-check= \
  61. --with-thin-dump= \
  62. --with-thin-repair= \
  63. --with-thin-restore= \
  64. --with-cache-check= \
  65. --with-cache-dump= \
  66. --with-cache-repair= \
  67. --with-cache-restore= \
  68. --enable-lvm1_fallback \
  69. --with-default-pid-dir=/run \
  70. --with-default-run-dir=/run/lvm \
  71. --with-default-locking-dir=/run/lock/lvm \
  72. --with-dmeventd-path=/sbin/dmeventd \
  73. --enable-fsadm \
  74. --with-pool=internal \
  75. --with-user= \
  76. --with-group= \
  77. --with-usrlibdir=/usr/lib \
  78. --with-usrsbindir=%s \
  79. --with-udevdir=/lib/udev/rules.d \
  80. --with-device-uid=0 \
  81. --with-device-gid=6 \
  82. --with-device-mode=0660 \
  83. --enable-dmeventd \
  84. --enable-udev_rules \
  85. --enable-udev_sync \
  86. --with-snapshots=internal \
  87. --with-mirrors=internal \
  88. --with-interface=ioctl \
  89. --enable-static_link=no \
  90. --disable-readline \
  91. --disable-realtime \
  92. --disable-selinux \
  93. --with-confdir=/etc \
  94. --enable-applib \
  95. --enable-cmdlib \
  96. --enable-pkgconfig " % get.sbinDIR())
  97. # inarytools.dosed("make.tmpl","-lm","")
  98. def build():
  99. autotools.make("-C include")
  100. #autotools.make("-C libdm")
  101. #autotools.make("-C lib")
  102. autotools.make()
  103. def install():
  104. autotools.rawInstall('DESTDIR=%s' % get.installDIR())
  105. for dir in ["archive", "backup", "cache"]:
  106. inarytools.dodir("/etc/lvm/%s" % dir)
  107. shelltools.chmod(get.installDIR() + "/etc/lvm/%s" % dir, 0o700)
  108. #inarytools.move("/sbin/lvmconf","scripts/lvmconf.sh")
  109. # builddiet()
  110. inarytools.dodoc("COPYING", "COPYING.LIB", "README", "VERSION", "VERSION_DM", "WHATS_NEW", "WHATS_NEW_DM")