1
0

Makefile 4.2 KB

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