1
0

Makefile 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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.1.5
  10. PKG_RELEASE:=3
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=http://www.lua.org/ftp/ \
  13. http://www.tecgraf.puc-rio.br/lua/ftp/
  14. PKG_HASH:=2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333
  15. PKG_BUILD_PARALLEL:=1
  16. PKG_LICENSE:=MIT
  17. PKG_LICENSE_FILES:=COPYRIGHT
  18. HOST_PATCH_DIR := ./patches-host
  19. include $(INCLUDE_DIR)/package.mk
  20. include $(INCLUDE_DIR)/host-build.mk
  21. define Package/lua/Default
  22. SUBMENU:=Lua
  23. SECTION:=lang
  24. CATEGORY:=Languages
  25. TITLE:=Lua programming language
  26. URL:=http://www.lua.org/
  27. MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
  28. endef
  29. define Package/lua/Default/description
  30. Lua is a powerful light-weight programming language designed for extending
  31. applications. Lua is also frequently used as a general-purpose, stand-alone
  32. language. Lua is free software.
  33. endef
  34. define Package/liblua
  35. $(call Package/lua/Default)
  36. SUBMENU:=
  37. SECTION:=libs
  38. CATEGORY:=Libraries
  39. TITLE+= (libraries)
  40. ABI_VERSION:=5.1.5
  41. endef
  42. define Package/liblua/description
  43. $(call Package/lua/Default/description)
  44. This package contains the Lua shared libraries, needed by other programs.
  45. endef
  46. define Package/lua
  47. $(call Package/lua/Default)
  48. DEPENDS:=+liblua
  49. TITLE+= (interpreter)
  50. endef
  51. define Package/lua/description
  52. $(call Package/lua/Default/description)
  53. This package contains the Lua language interpreter.
  54. endef
  55. define Package/luac
  56. $(call Package/lua/Default)
  57. DEPENDS:=+liblua
  58. TITLE+= (compiler)
  59. endef
  60. define Package/luac/description
  61. $(call Package/lua/Default/description)
  62. This package contains the Lua language compiler.
  63. endef
  64. define Package/lua-examples
  65. $(call Package/lua/Default)
  66. DEPENDS:=lua
  67. TITLE+= (examples)
  68. endef
  69. define Package/lua-examples/description
  70. $(call Package/lua/Default/description)
  71. This package contains Lua language examples.
  72. endef
  73. define Build/Configure
  74. endef
  75. TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC) -std=gnu99
  76. define Build/Compile
  77. $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  78. CC="$(TARGET_CROSS)gcc" \
  79. AR="$(TARGET_CROSS)ar rcu" \
  80. RANLIB="$(TARGET_CROSS)ranlib" \
  81. INSTALL_ROOT=/usr \
  82. CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
  83. MYLDFLAGS="$(TARGET_LDFLAGS)" \
  84. PKG_VERSION=$(PKG_VERSION) \
  85. linux
  86. rm -rf $(PKG_INSTALL_DIR)
  87. mkdir -p $(PKG_INSTALL_DIR)
  88. $(MAKE) -C $(PKG_BUILD_DIR) \
  89. INSTALL_TOP="$(PKG_INSTALL_DIR)/usr" \
  90. install
  91. endef
  92. define Host/Configure
  93. $(SED) 's,"/usr/local/","$(STAGING_DIR_HOSTPKG)/",' $(HOST_BUILD_DIR)/src/luaconf.h
  94. endef
  95. ifeq ($(HOST_OS),Darwin)
  96. LUA_OS:=macosx
  97. else
  98. ifeq ($(HOST_OS),FreeBSD)
  99. LUA_OS:=freebsd
  100. else
  101. LUA_OS:=linux
  102. endif
  103. endif
  104. define Host/Compile
  105. $(MAKE) -C $(HOST_BUILD_DIR) \
  106. CC="$(HOSTCC) -std=gnu99" \
  107. $(LUA_OS)
  108. endef
  109. define Host/Install
  110. $(MAKE) -C $(HOST_BUILD_DIR) \
  111. INSTALL_TOP="$(STAGING_DIR_HOSTPKG)" \
  112. install
  113. endef
  114. define Build/InstallDev
  115. $(INSTALL_DIR) $(1)/usr/include
  116. $(CP) $(PKG_INSTALL_DIR)/usr/include/lua{,lib,conf}.h $(1)/usr/include/
  117. $(CP) $(PKG_INSTALL_DIR)/usr/include/lauxlib.h $(1)/usr/include/
  118. $(CP) $(PKG_INSTALL_DIR)/usr/include/lnum_config.h $(1)/usr/include/
  119. $(INSTALL_DIR) $(1)/usr/lib
  120. $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.{a,so*} $(1)/usr/lib/
  121. $(LN) liblua.so.$(PKG_VERSION) $(1)/usr/lib/liblualib.so
  122. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  123. $(CP) $(PKG_BUILD_DIR)/etc/lua.pc $(1)/usr/lib/pkgconfig/
  124. endef
  125. define Package/liblua/install
  126. $(INSTALL_DIR) $(1)/usr/lib
  127. $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.so.* $(1)/usr/lib/
  128. endef
  129. define Package/lua/install
  130. $(INSTALL_DIR) $(1)/usr/bin
  131. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lua $(1)/usr/bin/
  132. endef
  133. define Package/luac/install
  134. $(INSTALL_DIR) $(1)/usr/bin
  135. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luac $(1)/usr/bin/
  136. endef
  137. define Package/lua-examples/install
  138. $(INSTALL_DIR) $(1)/usr/share/lua/examples
  139. $(INSTALL_DATA) $(PKG_BUILD_DIR)/test/*.lua \
  140. $(1)/usr/share/lua/examples/
  141. endef
  142. $(eval $(call BuildPackage,liblua))
  143. $(eval $(call BuildPackage,lua))
  144. $(eval $(call BuildPackage,luac))
  145. $(eval $(call BuildPackage,lua-examples))
  146. $(eval $(call HostBuild))