Makefile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. #
  2. # Copyright (C) 2006-2014 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. include $(TOPDIR)/rules.mk
  7. include $(INCLUDE_DIR)/kernel.mk
  8. include $(INCLUDE_DIR)/version.mk
  9. include $(INCLUDE_DIR)/feeds.mk
  10. PKG_NAME:=opkg
  11. PKG_REV:=9c97d5ecd795709c8584e972bfdf3aee3a5b846d
  12. PKG_VERSION:=$(PKG_REV)
  13. PKG_RELEASE:=7
  14. PKG_SOURCE_PROTO:=git
  15. PKG_SOURCE_VERSION:=$(PKG_REV)
  16. PKG_SOURCE_SUBDIR:=opkg-$(PKG_VERSION)
  17. PKG_SOURCE_URL:=http://git.yoctoproject.org/git/opkg
  18. PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
  19. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  20. PKG_FIXUP:=autoreconf
  21. PKG_REMOVE_FILES = autogen.sh aclocal.m4
  22. PKG_LICENSE:=GPL-2.0
  23. PKG_LICENSE_FILES:=COPYING
  24. PKG_BUILD_PARALLEL:=1
  25. HOST_BUILD_PARALLEL:=1
  26. PKG_INSTALL:=1
  27. include $(INCLUDE_DIR)/package.mk
  28. include $(INCLUDE_DIR)/host-build.mk
  29. define Package/opkg/Default
  30. SECTION:=base
  31. CATEGORY:=Base system
  32. TITLE:=opkg package manager
  33. MAINTAINER:=Jo-Philipp Wich <xm@subsignal.org>
  34. URL:=http://wiki.openmoko.org/wiki/Opkg
  35. endef
  36. define Package/opkg/Default/description
  37. Lightweight package management system
  38. opkg is the opkg Package Management System, for handling
  39. installation and removal of packages on a system. It can
  40. recursively follow dependencies and download all packages
  41. necessary to install a particular package.
  42. opkg knows how to install both .ipk and .deb packages.
  43. endef
  44. define Package/opkg
  45. $(call Package/opkg/Default)
  46. VARIANT:=unsigned
  47. endef
  48. define Package/opkg/description
  49. $(call Package/opkg/Default/description)
  50. endef
  51. define Package/opkg/conffiles
  52. /etc/opkg.conf
  53. endef
  54. define Package/opkg-smime
  55. $(call Package/opkg/Default)
  56. TITLE+= (with S/MIME signature support)
  57. DEPENDS+=+libopenssl
  58. VARIANT:=smime
  59. endef
  60. define Package/opkg-smime/description
  61. $(call Package/opkg/Default/description)
  62. This package allows the Package index to be verified with S/MIME.
  63. endef
  64. Package/opkg-smime/conffiles = $(Package/opkg/conffiles)
  65. TARGET_CFLAGS += $(if $(CONFIG_GCC_VERSION_4_3)$(CONFIG_GCC_VERSION_4_4),-Wno-array-bounds)
  66. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  67. EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
  68. CONFIGURE_ARGS += \
  69. --disable-curl \
  70. --disable-gpg \
  71. --with-opkgetcdir=/etc \
  72. --with-opkglockfile=/var/lock/opkg.lock
  73. ifeq ($(BUILD_VARIANT),smime)
  74. CONFIGURE_ARGS += --enable-openssl --enable-sha256
  75. endif
  76. MAKE_FLAGS = \
  77. CC="$(TARGET_CC)" \
  78. DESTDIR="$(PKG_INSTALL_DIR)" \
  79. HOST_CPU="$(PKGARCH)" \
  80. LDFLAGS="-Wl,--gc-sections" \
  81. define Package/opkg/Default/install
  82. $(INSTALL_DIR) $(1)/usr/lib/opkg
  83. $(INSTALL_DIR) $(1)/bin
  84. $(INSTALL_DIR) $(1)/etc
  85. $(INSTALL_DATA) ./files/opkg$(2).conf $(1)/etc/opkg.conf
  86. ifeq ($(CONFIG_PER_FEED_REPO),)
  87. echo "src/gz %n %U" >> $(1)/etc/opkg.conf
  88. else
  89. for d in base $(FEEDS_ENABLED); do \
  90. echo "src/gz %n_$$$$d %U/$$$$d" >> $(1)/etc/opkg.conf; \
  91. done
  92. ifneq ($(CONFIG_PER_FEED_REPO_ADD_DISABLED),)
  93. for d in $(FEEDS_DISABLED); do \
  94. echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %n_$$$$d %U/$$$$d" >> $(1)/etc/opkg.conf; \
  95. done
  96. endif
  97. endif
  98. $(VERSION_SED) $(1)/etc/opkg.conf
  99. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg
  100. endef
  101. Package/opkg/install = $(call Package/opkg/Default/install,$(1),)
  102. define Package/opkg-smime/install
  103. $(call Package/opkg/Default/install,$(1),-smime)
  104. $(INSTALL_DIR) $(1)/etc/ssl/certs
  105. $(if $(CONFIG_OPKGSMIME_CERT),$(INSTALL_DATA) $(call qstrip,$(CONFIG_OPKGSMIME_CERT)) $(1)/etc/ssl/certs/opkg.pem,)
  106. endef
  107. define Build/InstallDev
  108. mkdir -p $(1)/usr/include
  109. $(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/
  110. endef
  111. HOST_CONFIGURE_ARGS+= \
  112. --disable-curl \
  113. --disable-gpg \
  114. --with-opkgetcdir=/etc \
  115. --with-opkglockfile=/tmp/opkg.lock
  116. define Host/Compile
  117. +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) CC="$(HOSTCC)" all
  118. endef
  119. define Host/Install
  120. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg
  121. endef
  122. $(eval $(call BuildPackage,opkg))
  123. $(eval $(call BuildPackage,opkg-smime))
  124. $(eval $(call HostBuild))