Makefile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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_RELEASE:=17
  13. PKG_SOURCE_PROTO:=git
  14. PKG_SOURCE_URL:=http://git.yoctoproject.org/git/opkg
  15. PKG_SOURCE_DATE:=2011-04-08
  16. PKG_SOURCE_VERSION:=9c97d5ecd795709c8584e972bfdf3aee3a5b846d
  17. PKG_MIRROR_HASH:=55e05270f3eb2f3aff5d3791463ce3d13b8197ca7b301cd58e731a249552c48f
  18. PKG_FIXUP:=autoreconf
  19. PKG_REMOVE_FILES = autogen.sh aclocal.m4
  20. PKG_LICENSE:=GPL-2.0
  21. PKG_LICENSE_FILES:=COPYING
  22. PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
  23. PKG_FLAGS := nonshared
  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
  31. SECTION:=base
  32. CATEGORY:=Base system
  33. TITLE:=opkg package manager
  34. DEPENDS:=+uclient-fetch +libpthread
  35. URL:=http://wiki.openmoko.org/wiki/Opkg
  36. MENU:=1
  37. endef
  38. define Package/opkg/description
  39. Lightweight package management system
  40. opkg is the opkg Package Management System, for handling
  41. installation and removal of packages on a system. It can
  42. recursively follow dependencies and download all packages
  43. necessary to install a particular package.
  44. opkg knows how to install both .ipk and .deb packages.
  45. endef
  46. define Package/opkg/config
  47. config OPKG_SUPPORT_MD5
  48. bool
  49. default n
  50. depends on PACKAGE_opkg
  51. prompt "Support reading old md5 hashes."
  52. help
  53. Old opkg used md5s, new uses sha. This options enables understanding both while prefering sha.
  54. endef
  55. define Package/opkg/conffiles
  56. /etc/opkg.conf
  57. /etc/opkg/keys/
  58. /etc/opkg/customfeeds.conf
  59. endef
  60. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  61. EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
  62. CONFIGURE_ARGS += \
  63. --disable-curl \
  64. --disable-gpg \
  65. --enable-sha256 \
  66. --with-opkgetcdir=/etc \
  67. --with-opkglockfile=/var/lock/opkg.lock
  68. ifndef CONFIG_SIGNED_PACKAGES
  69. CONFIGURE_ARGS += --disable-usign
  70. endif
  71. ifeq ($(CONFIG_OPKG_SUPPORT_MD5),y)
  72. CONFIGURE_ARGS += --enable-md5
  73. else
  74. CONFIGURE_ARGS += --disable-md5
  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/opkg
  85. $(INSTALL_DIR) $(1)/etc/uci-defaults
  86. $(INSTALL_DATA) ./files/customfeeds.conf $(1)/etc/opkg/customfeeds.conf
  87. $(INSTALL_DATA) ./files/opkg$(2).conf $(1)/etc/opkg.conf
  88. $(call FeedSourcesAppend,$(1)/etc/opkg/distfeeds.conf)
  89. $(VERSION_SED) $(1)/etc/opkg/distfeeds.conf
  90. $(INSTALL_BIN) ./files/20_migrate-feeds $(1)/etc/uci-defaults/
  91. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opkg-cl $(1)/bin/opkg
  92. endef
  93. define Package/opkg/install
  94. $(call Package/opkg/Default/install,$(1),)
  95. ifneq ($(CONFIG_SIGNED_PACKAGES),)
  96. echo "option check_signature 1" >> $(1)/etc/opkg.conf
  97. endif
  98. mkdir $(1)/usr/sbin
  99. $(INSTALL_BIN) ./files/opkg-key $(1)/usr/sbin/
  100. endef
  101. define Build/InstallDev
  102. mkdir -p $(1)/usr/include
  103. $(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/
  104. endef
  105. HOST_CONFIGURE_ARGS+= \
  106. --disable-curl \
  107. --disable-gpg \
  108. --enable-sha256 \
  109. --with-opkgetcdir=/etc \
  110. --with-opkglockfile=/tmp/opkg.lock
  111. define Host/Compile
  112. +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) CC="$(HOSTCC)" all
  113. endef
  114. define Host/Install
  115. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg
  116. endef
  117. $(eval $(call BuildPackage,opkg))
  118. $(eval $(call HostBuild))