Makefile 4.2 KB

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