actions.py 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 pisi.actionsapi import shelltools
  7. from pisi.actionsapi import autotools
  8. from pisi.actionsapi import pisitools
  9. from pisi.actionsapi import get
  10. import os
  11. def setup():
  12. shelltools.export("AUTOPOINT", "true")
  13. autotools.autoreconf("-fi")
  14. autotools.configure("--with-rpmbuild=/bin/false \
  15. --with-drivers=all \
  16. --enable-nls \
  17. --without-aalib \
  18. --disable-rpath \
  19. --disable-lockdev \
  20. --disable-resmgr \
  21. --disable-ttylock \
  22. --disable-baudboy \
  23. --disable-static")
  24. pisitools.dosed("libtool", " -shared ", " -Wl,-O1,--as-needed -shared ")
  25. def build():
  26. autotools.make()
  27. def install():
  28. autotools.rawInstall("DESTDIR=%s \
  29. udevscriptdir=/lib/udev" % get.installDIR())
  30. HAL_FDI="usr/share/hal/fdi/information/20thirdparty/10-camera-libgphoto2.fdi"
  31. UDEV_RULES="lib/udev/rules.d/40-libgphoto2.rules"
  32. CAM_LIST="usr/lib/libgphoto2/print-camera-list"
  33. CAM_LIBS="usr/lib/libgphoto2/%s" % get.srcVERSION()
  34. # Create hal directory
  35. pisitools.dodir(shelltools.dirName(HAL_FDI))
  36. # Export the necessary env variables
  37. shelltools.export("CAMLIBS", "%s/%s" % (get.installDIR(), CAM_LIBS))
  38. shelltools.export("LIBDIR", "%s/usr/lib/" % get.installDIR())
  39. shelltools.export("LD_LIBRARY_PATH", "%s/usr/lib/" % get.installDIR())
  40. # Generate HAL FDI file
  41. f = open(os.path.join(get.installDIR(), HAL_FDI), "w")
  42. f.write(os.popen("%s/%s hal-fdi" % (get.installDIR(), CAM_LIST)).read())
  43. f.close()
  44. # Generate UDEV rule which will replace the HAL FDI when HAL is deprecated
  45. pisitools.dodir("/lib/udev/rules.d")
  46. f = open(os.path.join(get.installDIR(), UDEV_RULES), "w")
  47. f.write(os.popen("%s/%s udev-rules version 136" % (get.installDIR(), CAM_LIST)).read())
  48. f.close()
  49. pisitools.removeDir("/usr/share/doc/libgphoto2_port")
  50. pisitools.removeDir("/usr/share/libgphoto2_port")
  51. # Remove circular symlink
  52. pisitools.remove("/usr/include/gphoto2/gphoto2")
  53. pisitools.dodoc("ChangeLog", "NEWS*", "README", "AUTHORS", "TESTERS", "MAINTAINERS", "HACKING")