This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

hplip.mk

By: alllexx on Dec 30th, 2013  |  syntax: Make  |  size: 11.12 KB  |  views: 34  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ###########################################################
  2. #
  3. # hplip
  4. #
  5. ###########################################################
  6. #
  7. # HPLIP_VERSION, HPLIP_SITE and HPLIP_SOURCE define
  8. # the upstream location of the source code for the package.
  9. # HPLIP_DIR is the directory which is created when the source
  10. # archive is unpacked.
  11. # HPLIP_UNZIP is the command used to unzip the source.
  12. # It is usually "zcat" (for .gz) or "bzcat" (for .bz2)
  13. #
  14. # You should change all these variables to suit your package.
  15. # Please make sure that you add a description, and that you
  16. # list all your packages' dependencies, seperated by commas.
  17. #
  18. # If you list yourself as MAINTAINER, please give a valid email
  19. # address, and indicate your irc nick if it cannot be easily deduced
  20. # from your name or email address.  If you leave MAINTAINER set to
  21. # "NSLU2 Linux" other developers will feel free to edit.
  22. #
  23. HPLIP_SITE=http://$(SOURCEFORGE_MIRROR)/sourceforge/hplip
  24. HPLIP_VERSION=3.13.11
  25. HPLIP_SOURCE=hplip-$(HPLIP_VERSION).tar.gz
  26. HPLIP_DIR=hplip-$(HPLIP_VERSION)
  27. HPLIP_UNZIP=zcat
  28. HPLIP_MAINTAINER=NSLU2 Linux <nslu2-linux@yahoogroups.com>
  29. HPLIP_DESCRIPTION=HP Linux Imaging and Printing
  30. HPLIP_SECTION=misc
  31. HPLIP_PRIORITY=optional
  32. HPLIP_DEPENDS=sane-backends, python25, libstdc++
  33. ifneq (, $(filter net-snmp, $(PACKAGES)))
  34. HPLIP_DEPENDS +=, net-snmp
  35. endif
  36. HPLIP_SUGGESTS=cups, dbus
  37. HPLIP_CONFLICTS=
  38.  
  39. #
  40. # HPLIP_IPK_VERSION should be incremented when the ipk changes.
  41. #
  42. HPLIP_IPK_VERSION=1
  43.  
  44. #
  45. # HPLIP_CONFFILES should be a list of user-editable files
  46. HPLIP_CONFFILES=/opt/etc/hp/hplip.conf \
  47.                 /opt/etc/sane.d/dll.conf \
  48.                 /opt/etc/udev/rules.d/56-hpmud.rules
  49. #/opt/etc/init.d/SXXhplip
  50.  
  51. #
  52. # HPLIP_PATCHES should list any patches, in the the order in
  53. # which they should be applied to the source code.
  54. #
  55. #HPLIP_PATCHES=$(HPLIP_SOURCE_DIR)/configure.patch
  56.  
  57. #
  58. # If the compilation of the package requires additional
  59. # compilation or linking flags, then list them here.
  60. #
  61. HPLIP_CPPFLAGS=
  62. HPLIP_LDFLAGS=-lm
  63.  
  64. ifeq (, $(filter net-snmp, $(PACKAGES)))
  65. HPLIP_CONFIG_ARGS += --disable-network-build
  66. endif
  67.  
  68. #
  69. # HPLIP_BUILD_DIR is the directory in which the build is done.
  70. # HPLIP_SOURCE_DIR is the directory which holds all the
  71. # patches and ipkg control files.
  72. # HPLIP_IPK_DIR is the directory in which the ipk is built.
  73. # HPLIP_IPK is the name of the resulting ipk files.
  74. #
  75. # You should not change any of these variables.
  76. #
  77. HPLIP_BUILD_DIR=$(BUILD_DIR)/hplip
  78. HPLIP_SOURCE_DIR=$(SOURCE_DIR)/hplip
  79. HPLIP_IPK_DIR=$(BUILD_DIR)/hplip-$(HPLIP_VERSION)-ipk
  80. HPLIP_IPK=$(BUILD_DIR)/hplip_$(HPLIP_VERSION)-$(HPLIP_IPK_VERSION)_$(TARGET_ARCH).ipk
  81.  
  82. .PHONY: hplip-source hplip-unpack hplip hplip-stage hplip-ipk hplip-clean hplip-dirclean hplip-check
  83.  
  84. #
  85. # This is the dependency on the source code.  If the source is missing,
  86. # then it will be fetched from the site using wget.
  87. #
  88. $(DL_DIR)/$(HPLIP_SOURCE):
  89.         $(WGET) -P $(@D) $(HPLIP_SITE)/$(@F) || \
  90.         $(WGET) -P $(@D) $(SOURCES_NLO_SITE)/$(@F)
  91.  
  92. #
  93. # The source code depends on it existing within the download directory.
  94. # This target will be called by the top level Makefile to download the
  95. # source code's archive (.tar.gz, .bz2, etc.)
  96. #
  97. hplip-source: $(DL_DIR)/$(HPLIP_SOURCE) $(HPLIP_PATCHES)
  98.  
  99. #
  100. # This target unpacks the source code in the build directory.
  101. # If the source archive is not .tar.gz or .tar.bz2, then you will need
  102. # to change the commands here.  Patches to the source code are also
  103. # applied in this target as required.
  104. #
  105. # This target also configures the build within the build directory.
  106. # Flags such as LDFLAGS and CPPFLAGS should be passed into configure
  107. # and NOT $(MAKE) below.  Passing it to configure causes configure to
  108. # correctly BUILD the Makefile with the right paths, where passing it
  109. # to Make causes it to override the default search paths of the compiler.
  110. #
  111. # If the compilation of the package requires other packages to be staged
  112. # first, then do that first (e.g. "$(MAKE) <bar>-stage <baz>-stage").
  113. #
  114. # If the package uses  GNU libtool, you should invoke $(PATCH_LIBTOOL) as
  115. # shown below to make various patches to it.
  116. #
  117. $(HPLIP_BUILD_DIR)/.configured: $(DL_DIR)/$(HPLIP_SOURCE) $(HPLIP_PATCHES) make/hplip.mk
  118.         $(MAKE) cups-stage dbus-stage python25-stage sane-backends-stage
  119. ifneq (, $(filter net-snmp, $(PACKAGES)))
  120.         $(MAKE) net-snmp-stage
  121. endif
  122.         rm -rf $(BUILD_DIR)/$(HPLIP_DIR) $(@D)
  123.         $(HPLIP_UNZIP) $(DL_DIR)/$(HPLIP_SOURCE) | tar -C $(BUILD_DIR) -xvf -
  124.         if test -n "$(HPLIP_PATCHES)" ; \
  125.                 then cat $(HPLIP_PATCHES) | \
  126.                 patch -d $(BUILD_DIR)/$(HPLIP_DIR) -p0 ; \
  127.         fi
  128.         if test "$(BUILD_DIR)/$(HPLIP_DIR)" != "$(@D)" ; \
  129.                 then mv $(BUILD_DIR)/$(HPLIP_DIR) $(@D) ; \
  130.         fi
  131. #       sed -i -e 's|/etc/|/opt&|; /halpredir/s|/usr/share|/opt/share|' $(@D)/Makefile.am ; \
  132. #       cd $(@D) ; touch INSTALL NEWS README AUTHORS ChangeLog
  133. #       autoreconf -vif $(@D)
  134.         sed -e "s|-I/usr/local/include||" -i "$(@D)/configure"
  135.         (cd $(@D); \
  136.                 $(TARGET_CONFIGURE_OPTS) \
  137.                 CPPFLAGS="$(STAGING_CPPFLAGS) $(HPLIP_CPPFLAGS)" \
  138.                 LDFLAGS="$(STAGING_LDFLAGS) $(HPLIP_LDFLAGS)" \
  139.                 PYTHON=$(HOST_STAGING_PREFIX)/bin/python2.5 \
  140.                 PYTHONPATH=$(STAGING_LIB_DIR)/python2.5/site-packages \
  141.                 PKG_CONFIG_PATH=$(STAGING_LIB_DIR)/pkgconfig \
  142.                 ./configure \
  143.                 --build=$(GNU_HOST_NAME) \
  144.                 --host=$(GNU_TARGET_NAME) \
  145.                 --target=$(GNU_TARGET_NAME) \
  146.                 --prefix=/opt \
  147.                 --sysconfdir=/opt/etc \
  148.                 --disable-nls \
  149.                 --disable-static \
  150.                 $(HPLIP_CONFIG_ARGS) \
  151.                 --enable-scan-build \
  152.                 --enable-fax-build \
  153.                 --enable-libusb01_build \
  154.                 --disable-dependency-tracking \
  155.                 --with-cupsbackenddir=/opt/lib/cups/backend \
  156.                 --with-icondir=/opt/share/applications \
  157.                 --with-systraydir=/opt/etc/xdg/autostart \
  158.                 --with-cupsfilterdir=/opt/lib/cups/filter \
  159.         )
  160.         sed -i -e 's| /etc| /opt/etc|' -e 's|\$$(DESTDIR)/etc|\$$(DESTDIR)/opt/etc|' -e 's|/var/lib/hp|/opt/var/lib/hp|' -e \
  161.                 's|/usr/share/cups/mime|/opt/share/cups/mime|' -e 's|/usr/share/hal/fdi|/opt/share/hal/fdi|' -e 's|/usr/lib/systemd/system|/opt/lib/systemd/system|' $(@D)/Makefile
  162.         sed -i -e 's|/etc|/opt/etc|' $(@D)/check.py \
  163.                                         $(@D)/logcapture.py \
  164.                                         $(@D)/ui4/devmgr5.py \
  165.                                         $(@D)/prnt/cups.py \
  166.                                         $(@D)/ui/devmgr4.py \
  167.                                         $(@D)/installer/core_install.py \
  168.                                         $(@D)/installer/pluginhandler.py \
  169.                                         $(@D)/base/password.py \
  170.                                         $(@D)/base/services.py \
  171.                                         $(@D)/base/codes.py \
  172.                                         $(@D)/base/g.py \
  173.                                         $(@D)/base/queues.py \
  174.                                         $(@D)/base/utils.py \
  175.                                         $(@D)/prnt/filters/hpps \
  176.                                         $(@D)/prnt/hpijs/globals.cpp \
  177.                                         $(@D)/prnt/hpijs/hpcupsfax.cpp \
  178.                                         $(@D)/prnt/hpijs/hpijs.cpp \
  179.                                         $(@D)/prnt/hpcups/HPCupsFilter.cpp \
  180.                                         $(@D)/fax/backend/hpfax.py
  181.         sed -i -e 's|/etc|/opt/etc|g' $(@D)/data/rules/56-hpmud.rules
  182.         sed -i -e 's|/var/lib/hp|/opt/var/lib/hp|' $(@D)/installer/core_install.py \
  183.                                                         $(@D)/installer/pluginhandler.py \
  184.                                                         $(@D)/base/g.py \
  185.                                                         $(@D)/check.py \
  186.                                                         $(@D)/common/utils.c \
  187.                                                         $(@D)/common/utils.h
  188.         sed -i -e 's|/usr/lib/systemd/system|/opt/lib/systemd/system|' $(@D)/installer/core_install.py
  189.         sed -i -e 's|filename\.startswith("/opt/etc/")|filename.startswith("/etc/") or filename.startswith("/opt/etc/")|' $(@D)/base/g.py
  190.         sed -i -e 's|/usr/share/cups/mime|/opt/share/cups/mime|' $(@D)/prnt/cups.py
  191.         $(PATCH_LIBTOOL) $(@D)/libtool
  192.         touch $@
  193.  
  194. hplip-unpack: $(HPLIP_BUILD_DIR)/.configured
  195.  
  196. #
  197. # This builds the actual binary.
  198. #
  199. $(HPLIP_BUILD_DIR)/.built: $(HPLIP_BUILD_DIR)/.configured
  200.         rm -f $@
  201.         $(MAKE) -C $(@D) PYTHONINCLUDEDIR="$(STAGING_INCLUDE_DIR)/python2.5"
  202.         ### use /opt/bin/python2.5
  203.         sed -i -e 's|^#!.*|#!/opt/bin/python2.5|' `find $(@D) -type f -name "*.py"`
  204.         touch $@
  205.  
  206. #
  207. # This is the build convenience target.
  208. #
  209. hplip: $(HPLIP_BUILD_DIR)/.built
  210.  
  211. #
  212. # If you are building a library, then you need to stage it too.
  213. #
  214. $(HPLIP_BUILD_DIR)/.staged: $(HPLIP_BUILD_DIR)/.built
  215.         rm -f $@
  216.         $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install
  217.         touch $@
  218.  
  219. hplip-stage: $(HPLIP_BUILD_DIR)/.staged
  220.  
  221. #
  222. # This rule creates a control file for ipkg.  It is no longer
  223. # necessary to create a seperate control file under sources/hplip
  224. #
  225. $(HPLIP_IPK_DIR)/CONTROL/control:
  226.         @install -d $(@D)
  227.         @rm -f $@
  228.         @echo "Package: hplip" >>$@
  229.         @echo "Architecture: $(TARGET_ARCH)" >>$@
  230.         @echo "Priority: $(HPLIP_PRIORITY)" >>$@
  231.         @echo "Section: $(HPLIP_SECTION)" >>$@
  232.         @echo "Version: $(HPLIP_VERSION)-$(HPLIP_IPK_VERSION)" >>$@
  233.         @echo "Maintainer: $(HPLIP_MAINTAINER)" >>$@
  234.         @echo "Source: $(HPLIP_SITE)/$(HPLIP_SOURCE)" >>$@
  235.         @echo "Description: $(HPLIP_DESCRIPTION)" >>$@
  236.         @echo "Depends: $(HPLIP_DEPENDS)" >>$@
  237.         @echo "Suggests: $(HPLIP_SUGGESTS)" >>$@
  238.         @echo "Conflicts: $(HPLIP_CONFLICTS)" >>$@
  239.  
  240. #
  241. # This builds the IPK file.
  242. #
  243. # Binaries should be installed into $(HPLIP_IPK_DIR)/opt/sbin or $(HPLIP_IPK_DIR)/opt/bin
  244. # (use the location in a well-known Linux distro as a guide for choosing sbin or bin).
  245. # Libraries and include files should be installed into $(HPLIP_IPK_DIR)/opt/{lib,include}
  246. # Configuration files should be installed in $(HPLIP_IPK_DIR)/opt/etc/hplip/...
  247. # Documentation files should be installed in $(HPLIP_IPK_DIR)/opt/doc/hplip/...
  248. # Daemon startup scripts should be installed in $(HPLIP_IPK_DIR)/opt/etc/init.d/S??hplip
  249. #
  250. # You may need to patch your application to make it use these locations.
  251. #
  252. $(HPLIP_IPK): $(HPLIP_BUILD_DIR)/.built
  253.         rm -rf $(HPLIP_IPK_DIR) $(BUILD_DIR)/hplip_*_$(TARGET_ARCH).ipk
  254.         $(MAKE) -C $(HPLIP_BUILD_DIR) DESTDIR=$(HPLIP_IPK_DIR) install-strip
  255.         rm -rf $(HPLIP_IPK_DIR)/opt/lib/*.la $(HPLIP_IPK_DIR)/opt/lib/*/*.la
  256. #       install -d $(HPLIP_IPK_DIR)/opt/etc/
  257. #       install -m 644 $(HPLIP_SOURCE_DIR)/hplip.conf $(HPLIP_IPK_DIR)/opt/etc/hplip.conf
  258. #       install -d $(HPLIP_IPK_DIR)/opt/etc/init.d
  259. #       install -m 755 $(HPLIP_SOURCE_DIR)/rc.hplip $(HPLIP_IPK_DIR)/opt/etc/init.d/SXXhplip
  260. #       sed -i -e '/^#!/aOPTWARE_TARGET=${OPTWARE_TARGET}' $(HPLIP_IPK_DIR)/opt/etc/init.d/SXXhplip
  261.         $(MAKE) $(HPLIP_IPK_DIR)/CONTROL/control
  262. #       install -m 755 $(HPLIP_SOURCE_DIR)/postinst $(HPLIP_IPK_DIR)/CONTROL/postinst
  263. #       sed -i -e '/^#!/aOPTWARE_TARGET=${OPTWARE_TARGET}' $(HPLIP_IPK_DIR)/CONTROL/postinst
  264. #       install -m 755 $(HPLIP_SOURCE_DIR)/prerm $(HPLIP_IPK_DIR)/CONTROL/prerm
  265. #       sed -i -e '/^#!/aOPTWARE_TARGET=${OPTWARE_TARGET}' $(HPLIP_IPK_DIR)/CONTROL/prerm
  266. #       if test -n "$(UPD-ALT_PREFIX)"; then \
  267.                 sed -i -e '/^[  ]*update-alternatives /s|update-alternatives|$(UPD-ALT_PREFIX)/bin/&|' \
  268.                         $(HPLIP_IPK_DIR)/CONTROL/postinst $(HPLIP_IPK_DIR)/CONTROL/prerm; \
  269.         fi
  270.         echo $(HPLIP_CONFFILES) | sed -e 's/ /\n/g' > $(HPLIP_IPK_DIR)/CONTROL/conffiles
  271.         cd $(BUILD_DIR); $(IPKG_BUILD) $(HPLIP_IPK_DIR)
  272.         $(WHAT_TO_DO_WITH_IPK_DIR) $(HPLIP_IPK_DIR)
  273.  
  274. #
  275. # This is called from the top level makefile to create the IPK file.
  276. #
  277. hplip-ipk: $(HPLIP_IPK)
  278.  
  279. #
  280. # This is called from the top level makefile to clean all of the built files.
  281. #
  282. hplip-clean:
  283.         rm -f $(HPLIP_BUILD_DIR)/.built
  284.         -$(MAKE) -C $(HPLIP_BUILD_DIR) clean
  285.  
  286. #
  287. # This is called from the top level makefile to clean all dynamically created
  288. # directories.
  289. #
  290. hplip-dirclean:
  291.         rm -rf $(BUILD_DIR)/$(HPLIP_DIR) $(HPLIP_BUILD_DIR) $(HPLIP_IPK_DIR) $(HPLIP_IPK)
  292. #
  293. #
  294. # Some sanity check for the package.
  295. #
  296. hplip-check: $(HPLIP_IPK)
  297.         perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $^
clone this paste RAW Paste Data