Makefile 3.7 KB

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