Makefile 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=lua
  9. PKG_VERSION:=5.3.5
  10. PKG_RELEASE:=5
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=https://www.lua.org/ftp/ \
  13. https://www.tecgraf.puc-rio.br/lua/ftp/
  14. PKG_HASH:=0c2eed3f960446e1a3e4b9a1ca2f3ff893b6ce41942cf54d5dd59ab4b3b058ac
  15. PKG_BUILD_PARALLEL:=1
  16. PKG_LICENSE:=MIT
  17. PKG_LICENSE_FILES:=COPYRIGHT
  18. PKG_CPE_ID:=cpe:/a:lua:lua
  19. HOST_PATCH_DIR := ./patches-host
  20. include $(INCLUDE_DIR)/package.mk
  21. include $(INCLUDE_DIR)/host-build.mk
  22. define Package/lua5.3/Default
  23. SUBMENU:=Lua
  24. SECTION:=lang
  25. CATEGORY:=Languages
  26. TITLE:=Lua programming language (version 5.3)
  27. URL:=https://www.lua.org/
  28. MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
  29. endef
  30. define Package/lua5.3/Default/description
  31. Lua is a powerful, efficient, lightweight, embeddable scripting language. It
  32. supports procedural programming, object-oriented programming, functional
  33. programming, data-driven programming, and data description.
  34. endef
  35. define Package/liblua5.3
  36. $(call Package/lua5.3/Default)
  37. SUBMENU:=
  38. SECTION:=libs
  39. CATEGORY:=Libraries
  40. TITLE+= (libraries)
  41. ABI_VERSION:=5.3
  42. endef
  43. define Package/liblua5.3/description
  44. $(call Package/lua5.3/Default/description)
  45. This package contains the Lua shared libraries, needed by other programs.
  46. endef
  47. define Package/lua5.3
  48. $(call Package/lua5.3/Default)
  49. DEPENDS:=+liblua5.3
  50. TITLE+= (interpreter)
  51. endef
  52. define Package/lua5.3/description
  53. $(call Package/lua5.3/Default/description)
  54. This package contains the Lua language interpreter.
  55. endef
  56. define Package/luac5.3
  57. $(call Package/lua5.3/Default)
  58. DEPENDS:=+liblua5.3
  59. TITLE+= (compiler)
  60. endef
  61. define Package/luac5.3/description
  62. $(call Package/lua5.3/Default/description)
  63. This package contains the Lua language compiler.
  64. endef
  65. TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC) -std=gnu99
  66. define Build/Compile
  67. $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  68. CC="$(TARGET_CROSS)gcc" \
  69. AR="$(TARGET_CROSS)ar rcu" \
  70. RANLIB="$(TARGET_CROSS)ranlib" \
  71. INSTALL_ROOT=/usr \
  72. CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
  73. PKG_VERSION=$(PKG_VERSION) \
  74. linux
  75. rm -rf $(PKG_INSTALL_DIR)
  76. mkdir -p $(PKG_INSTALL_DIR)
  77. $(MAKE) -C $(PKG_BUILD_DIR) \
  78. INSTALL_TOP="$(PKG_INSTALL_DIR)/usr" \
  79. install
  80. endef
  81. define Host/Configure
  82. $(SED) 's,"/usr/local/","$(STAGING_DIR_HOSTPKG)/",' $(HOST_BUILD_DIR)/src/luaconf.h
  83. endef
  84. ifeq ($(HOST_OS),Darwin)
  85. LUA_OS:=macosx
  86. else
  87. ifeq ($(HOST_OS),FreeBSD)
  88. LUA_OS:=freebsd
  89. else
  90. LUA_OS:=linux
  91. endif
  92. endif
  93. define Host/Compile
  94. $(MAKE) -C $(HOST_BUILD_DIR) \
  95. CC="$(HOSTCC) $(HOST_FPIC) -std=gnu99" \
  96. $(LUA_OS)
  97. endef
  98. define Host/Install
  99. $(MAKE) -C $(HOST_BUILD_DIR) \
  100. INSTALL_TOP="$(STAGING_DIR_HOSTPKG)" \
  101. install
  102. endef
  103. define Build/InstallDev
  104. $(INSTALL_DIR) $(1)/usr/include/lua5.3 $(1)/usr/lib
  105. $(CP) $(PKG_INSTALL_DIR)/usr/include/lua5.3/lua{,lib,conf}.h $(1)/usr/include/lua5.3/
  106. $(CP) $(PKG_INSTALL_DIR)/usr/include/lua5.3/lua.hpp $(1)/usr/include/lua5.3/
  107. $(CP) $(PKG_INSTALL_DIR)/usr/include/lua5.3/lauxlib.h $(1)/usr/include/lua5.3/
  108. $(INSTALL_DIR) $(1)/usr/lib
  109. $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua5.3.{a,so*} $(1)/usr/lib/
  110. $(LN) liblua5.3.so.0.0.0 $(1)/usr/lib/liblualib5.3.so
  111. endef
  112. define Package/liblua5.3/install
  113. $(INSTALL_DIR) $(1)/usr/lib
  114. $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua5.3.so* $(1)/usr/lib/
  115. endef
  116. define Package/lua5.3/install
  117. $(INSTALL_DIR) $(1)/usr/bin
  118. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lua5.3 $(1)/usr/bin/
  119. endef
  120. define Package/luac5.3/install
  121. $(INSTALL_DIR) $(1)/usr/bin
  122. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luac5.3 $(1)/usr/bin/
  123. endef
  124. $(eval $(call BuildPackage,liblua5.3))
  125. $(eval $(call BuildPackage,lua5.3))
  126. $(eval $(call BuildPackage,luac5.3))
  127. $(eval $(call HostBuild))