Makefile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. #
  2. # Copyright (C) 2006-2015 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:=9
  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_CONFIG_DEPENDS := CONFIG_SIGNED_PACKAGES
  25. PKG_BUILD_PARALLEL:=1
  26. HOST_BUILD_PARALLEL:=1
  27. PKG_INSTALL:=1
  28. include $(INCLUDE_DIR)/package.mk
  29. include $(INCLUDE_DIR)/host-build.mk
  30. define Package/opkg/Default
  31. SECTION:=base
  32. CATEGORY:=Base system
  33. TITLE:=opkg package manager
  34. MAINTAINER:=Jo-Philipp Wich <xm@subsignal.org>
  35. URL:=http://wiki.openmoko.org/wiki/Opkg
  36. endef
  37. define Package/opkg/Default/description
  38. Lightweight package management system
  39. opkg is the opkg Package Management System, for handling
  40. installation and removal of packages on a system. It can
  41. recursively follow dependencies and download all packages
  42. necessary to install a particular package.
  43. opkg knows how to install both .ipk and .deb packages.
  44. endef
  45. define Package/opkg
  46. $(call Package/opkg/Default)
  47. VARIANT:=unsigned
  48. endef
  49. define Package/opkg/description
  50. $(call Package/opkg/Default/description)
  51. endef
  52. define Package/opkg/conffiles
  53. /etc/opkg.conf
  54. /etc/opkg/keys/
  55. /etc/opkg/customfeeds.conf
  56. endef
  57. define Package/opkg-smime
  58. $(call Package/opkg/Default)
  59. TITLE+= (with S/MIME signature support)
  60. DEPENDS+=+libopenssl
  61. VARIANT:=smime
  62. endef
  63. define Package/opkg-smime/description
  64. $(call Package/opkg/Default/description)
  65. This package allows the Package index to be verified with S/MIME.
  66. endef
  67. Package/opkg-smime/conffiles = $(Package/opkg/conffiles)
  68. TARGET_CFLAGS += $(if $(CONFIG_GCC_VERSION_4_3)$(CONFIG_GCC_VERSION_4_4),-Wno-array-bounds)
  69. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  70. EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
  71. CONFIGURE_ARGS += \
  72. --disable-curl \
  73. --disable-gpg \
  74. --enable-sha256 \
  75. --with-opkgetcdir=/etc \
  76. --with-opkglockfile=/var/lock/opkg.lock
  77. ifeq ($(BUILD_VARIANT),smime)
  78. CONFIGURE_ARGS += --enable-openssl --disable-usign
  79. else
  80. ifndef CONFIG_SIGNED_PACKAGES
  81. CONFIGURE_ARGS += --disable-usign
  82. endif
  83. endif
  84. MAKE_FLAGS = \
  85. CC="$(TARGET_CC)" \
  86. DESTDIR="$(PKG_INSTALL_DIR)" \
  87. HOST_CPU="$(PKGARCH)" \
  88. LDFLAGS="-Wl,--gc-sections" \
  89. define Package/opkg/Default/install
  90. $(INSTALL_DIR) $(1)/usr/lib/opkg
  91. $(INSTALL_DIR) $(1)/bin
  92. $(INSTALL_DIR) $(1)/etc/opkg
  93. $(INSTALL_DIR) $(1)/etc/uci-defaults
  94. $(INSTALL_DATA) ./files/customfeeds.conf $(1)/etc/opkg/customfeeds.conf
  95. $(INSTALL_DATA) ./files/opkg$(2).conf $(1)/etc/opkg.conf
  96. $(call FeedSourcesAppend,$(1)/etc/opkg/distfeeds.conf)
  97. $(VERSION_SED) $(1)/etc/opkg/distfeeds.conf
  98. $(INSTALL_BIN) ./files/20_migrate-feeds $(1)/etc/uci-defaults/
  99. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg
  100. endef
  101. define Package/opkg/install
  102. $(call Package/opkg/Default/install,$(1),)
  103. ifneq ($(CONFIG_SIGNED_PACKAGES),)
  104. echo "option check_signature 1" >> $(1)/etc/opkg.conf
  105. endif
  106. mkdir $(1)/usr/sbin
  107. $(INSTALL_BIN) ./files/opkg-key $(1)/usr/sbin/
  108. endef
  109. define Package/opkg-smime/install
  110. $(call Package/opkg/Default/install,$(1),-smime)
  111. $(INSTALL_DIR) $(1)/etc/ssl/certs
  112. $(if $(CONFIG_OPKGSMIME_CERT),$(INSTALL_DATA) $(call qstrip,$(CONFIG_OPKGSMIME_CERT)) $(1)/etc/ssl/certs/opkg.pem,)
  113. endef
  114. define Build/InstallDev
  115. mkdir -p $(1)/usr/include
  116. $(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/
  117. endef
  118. HOST_CONFIGURE_ARGS+= \
  119. --disable-curl \
  120. --disable-gpg \
  121. --enable-sha256 \
  122. --with-opkgetcdir=/etc \
  123. --with-opkglockfile=/tmp/opkg.lock
  124. define Host/Compile
  125. +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) CC="$(HOSTCC)" all
  126. endef
  127. define Host/Install
  128. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg
  129. endef
  130. $(eval $(call BuildPackage,opkg))
  131. $(eval $(call BuildPackage,opkg-smime))
  132. $(eval $(call HostBuild))