Makefile 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. #
  2. # Copyright (C) 2006-2015 OpenWrt.org
  3. # Copyright (C) 2016 LEDE Project
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. include $(TOPDIR)/rules.mk
  8. include $(INCLUDE_DIR)/kernel.mk
  9. include $(INCLUDE_DIR)/version.mk
  10. include $(INCLUDE_DIR)/feeds.mk
  11. PKG_NAME:=opkg
  12. PKG_REV:=9c97d5ecd795709c8584e972bfdf3aee3a5b846d
  13. PKG_VERSION:=$(PKG_REV)
  14. PKG_RELEASE:=15
  15. PKG_SOURCE_PROTO:=git
  16. PKG_SOURCE_VERSION:=$(PKG_REV)
  17. PKG_SOURCE_SUBDIR:=opkg-$(PKG_VERSION)
  18. PKG_SOURCE_URL:=http://git.yoctoproject.org/git/opkg
  19. PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.xz
  20. PKG_MIRROR_MD5SUM:=abba824695a7dd4acf2a6371c4e22142656b3d1f0fa93c04410116d2170ce1a9
  21. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  22. PKG_FIXUP:=autoreconf
  23. PKG_REMOVE_FILES = autogen.sh aclocal.m4
  24. PKG_LICENSE:=GPL-2.0
  25. PKG_LICENSE_FILES:=COPYING
  26. PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
  27. PKG_FLAGS := nonshared
  28. PKG_CONFIG_DEPENDS := CONFIG_SIGNED_PACKAGES
  29. PKG_BUILD_PARALLEL:=1
  30. HOST_BUILD_PARALLEL:=1
  31. PKG_INSTALL:=1
  32. include $(INCLUDE_DIR)/package.mk
  33. include $(INCLUDE_DIR)/host-build.mk
  34. define Package/opkg/Default
  35. SECTION:=base
  36. CATEGORY:=Base system
  37. TITLE:=opkg package manager
  38. DEPENDS:=+uclient-fetch
  39. URL:=http://wiki.openmoko.org/wiki/Opkg
  40. MENU:=1
  41. endef
  42. define Package/opkg/Default/description
  43. Lightweight package management system
  44. opkg is the opkg Package Management System, for handling
  45. installation and removal of packages on a system. It can
  46. recursively follow dependencies and download all packages
  47. necessary to install a particular package.
  48. opkg knows how to install both .ipk and .deb packages.
  49. endef
  50. define Package/opkg/config
  51. config OPKG_SUPPORT_MD5
  52. bool
  53. default n
  54. depends on PACKAGE_opkg
  55. prompt "Support reading old md5 hashes."
  56. help
  57. Old opkg used md5s, new uses sha. This options enables understanding both while prefering sha.
  58. endef
  59. define Package/opkg
  60. $(call Package/opkg/Default)
  61. VARIANT:=unsigned
  62. endef
  63. define Package/opkg/description
  64. $(call Package/opkg/Default/description)
  65. endef
  66. define Package/opkg/conffiles
  67. /etc/opkg.conf
  68. /etc/opkg/keys/
  69. /etc/opkg/customfeeds.conf
  70. endef
  71. define Package/opkg-smime
  72. $(call Package/opkg/Default)
  73. TITLE+= (with S/MIME signature support)
  74. DEPENDS+=+PACKAGE_opkg-smime:libopenssl
  75. VARIANT:=smime
  76. endef
  77. define Package/opkg-smime/description
  78. $(call Package/opkg/Default/description)
  79. This package allows the Package index to be verified with S/MIME.
  80. endef
  81. define Package/opkg-smime/config
  82. config OPKG_SMIME_SUPPORT_MD5
  83. bool
  84. default n
  85. depends on PACKAGE_opkg-smime
  86. prompt "Support reading old md5 hashes."
  87. help
  88. Old opkg used md5s, new uses sha. This options enables understanding both while prefering sha.
  89. endef
  90. Package/opkg-smime/conffiles = $(Package/opkg/conffiles)
  91. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  92. EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
  93. CONFIGURE_ARGS += \
  94. --disable-curl \
  95. --disable-gpg \
  96. --enable-sha256 \
  97. --with-opkgetcdir=/etc \
  98. --with-opkglockfile=/var/lock/opkg.lock
  99. ifeq ($(BUILD_VARIANT),smime)
  100. CONFIGURE_ARGS += --enable-openssl --disable-usign
  101. ifeq ($(CONFIG_OPKG_SMIME_SUPPORT_MD5),y)
  102. CONFIGURE_ARGS += --enable-md5
  103. else
  104. CONFIGURE_ARGS += --disable-md5
  105. endif
  106. else
  107. ifndef CONFIG_SIGNED_PACKAGES
  108. CONFIGURE_ARGS += --disable-usign
  109. endif
  110. ifeq ($(CONFIG_OPKG_SUPPORT_MD5),y)
  111. CONFIGURE_ARGS += --enable-md5
  112. else
  113. CONFIGURE_ARGS += --disable-md5
  114. endif
  115. endif
  116. MAKE_FLAGS = \
  117. CC="$(TARGET_CC)" \
  118. DESTDIR="$(PKG_INSTALL_DIR)" \
  119. HOST_CPU="$(PKGARCH)" \
  120. LDFLAGS="-Wl,--gc-sections" \
  121. define Package/opkg/Default/install
  122. $(INSTALL_DIR) $(1)/usr/lib/opkg
  123. $(INSTALL_DIR) $(1)/bin
  124. $(INSTALL_DIR) $(1)/etc/opkg
  125. $(INSTALL_DIR) $(1)/etc/uci-defaults
  126. $(INSTALL_DATA) ./files/customfeeds.conf $(1)/etc/opkg/customfeeds.conf
  127. $(INSTALL_DATA) ./files/opkg$(2).conf $(1)/etc/opkg.conf
  128. $(call FeedSourcesAppend,$(1)/etc/opkg/distfeeds.conf)
  129. $(VERSION_SED) $(1)/etc/opkg/distfeeds.conf
  130. $(INSTALL_BIN) ./files/20_migrate-feeds $(1)/etc/uci-defaults/
  131. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg
  132. endef
  133. define Package/opkg/install
  134. $(call Package/opkg/Default/install,$(1),)
  135. ifneq ($(CONFIG_SIGNED_PACKAGES),)
  136. echo "option check_signature 1" >> $(1)/etc/opkg.conf
  137. endif
  138. mkdir $(1)/usr/sbin
  139. $(INSTALL_BIN) ./files/opkg-key $(1)/usr/sbin/
  140. endef
  141. define Package/opkg-smime/install
  142. $(call Package/opkg/Default/install,$(1),-smime)
  143. $(INSTALL_DIR) $(1)/etc/ssl/certs
  144. $(if $(CONFIG_OPKGSMIME_CERT),$(INSTALL_DATA) $(call qstrip,$(CONFIG_OPKGSMIME_CERT)) $(1)/etc/ssl/certs/opkg.pem,)
  145. endef
  146. define Build/InstallDev
  147. mkdir -p $(1)/usr/include
  148. $(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/
  149. endef
  150. HOST_CONFIGURE_ARGS+= \
  151. --disable-curl \
  152. --disable-gpg \
  153. --enable-sha256 \
  154. --with-opkgetcdir=/etc \
  155. --with-opkglockfile=/tmp/opkg.lock
  156. define Host/Compile
  157. +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) CC="$(HOSTCC)" all
  158. endef
  159. define Host/Install
  160. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg
  161. endef
  162. $(eval $(call BuildPackage,opkg))
  163. $(eval $(call BuildPackage,opkg-smime))
  164. $(eval $(call HostBuild))