Makefile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. #
  2. # Copyright (C) 2006-2008 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. # $Id$
  8. include $(TOPDIR)/rules.mk
  9. PKG_NAME:=lua
  10. PKG_VERSION:=5.1.4
  11. PKG_RELEASE:=3
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  13. PKG_SOURCE_URL:=http://www.lua.org/ftp/ \
  14. http://ftp.gwdg.de/pub/languages/lua/ \
  15. http://mirrors.dotsrc.org/lua/ \
  16. http://www.tecgraf.puc-rio.br/lua/ftp/
  17. PKG_MD5SUM:=d0870f2de55d59c1c8419f36e8fac150
  18. HOST_PATCH_DIR=./patches-host
  19. PKG_BUILD_DEPENDS:=lua/host
  20. include $(INCLUDE_DIR)/host-build.mk
  21. include $(INCLUDE_DIR)/package.mk
  22. define Package/lua/Default
  23. SUBMENU:=LUA
  24. SECTION:=lang
  25. CATEGORY:=Languages
  26. TITLE:=LUA programming language
  27. URL:=http://www.lua.org/
  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. endef
  41. define Package/liblua/description
  42. $(call Package/lua/Default/description)
  43. This package contains the LUA shared libraries, needed by other programs.
  44. endef
  45. define Package/lua
  46. $(call Package/lua/Default)
  47. DEPENDS:=+liblua
  48. TITLE+= (interpreter)
  49. endef
  50. define Package/lua/description
  51. $(call Package/lua/Default/description)
  52. This package contains the LUA language interpreter.
  53. endef
  54. define Package/luac
  55. $(call Package/lua/Default)
  56. DEPENDS:=+liblua
  57. TITLE+= (compiler)
  58. endef
  59. define Package/luac/description
  60. $(call Package/lua/Default/description)
  61. This package contains the LUA language compiler.
  62. endef
  63. define Package/lua-examples
  64. $(call Package/lua/Default)
  65. DEPENDS:=lua
  66. TITLE+= (examples)
  67. endef
  68. define Package/lua-examples/description
  69. $(call Package/lua/Default/description)
  70. This package contains LUA language examples.
  71. endef
  72. # Host build
  73. define Host/Configure
  74. endef
  75. define Host/Compile
  76. $(MAKE) -C $(HOST_BUILD_DIR)/src luac-host
  77. endef
  78. define Host/Install
  79. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/luac-host $(STAGING_DIR_HOST)/bin/luac
  80. endef
  81. # Target build
  82. TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC)
  83. ifneq ($(CONFIG_USE_EGLIBC),)
  84. ifeq ($(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),)
  85. TARGET_CFLAGS += -DNO_GETLOGIN
  86. endif
  87. endif
  88. Build/Configure=$(Host/Configure)
  89. define Build/Compile
  90. $(MAKE) -C $(PKG_BUILD_DIR) \
  91. CC="$(TARGET_CROSS)gcc" \
  92. AR="$(TARGET_CROSS)ar rcu" \
  93. RANLIB="$(TARGET_CROSS)ranlib" \
  94. INSTALL_ROOT=/usr \
  95. CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
  96. MYLDFLAGS="$(TARGET_LDFLAGS)" \
  97. PKG_VERSION=$(PKG_VERSION) \
  98. linux
  99. rm -rf $(PKG_INSTALL_DIR)
  100. mkdir -p $(PKG_INSTALL_DIR)
  101. $(MAKE) -C $(PKG_BUILD_DIR) \
  102. INSTALL_TOP="$(PKG_INSTALL_DIR)/usr" \
  103. install
  104. endef
  105. define Build/InstallDev
  106. mkdir -p $(1)/usr/include
  107. $(CP) $(PKG_INSTALL_DIR)/usr/include/lua{,lib,conf}.h $(1)/usr/include/
  108. $(CP) $(PKG_INSTALL_DIR)/usr/include/lauxlib.h $(1)/usr/include/
  109. $(CP) $(PKG_INSTALL_DIR)/usr/include/lnum_config.h $(1)/usr/include/
  110. mkdir -p $(1)/usr/lib
  111. $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.{a,so*} $(1)/usr/lib/
  112. ln -sf liblua.so.$(PKG_VERSION) $(1)/usr/lib/liblualib.so
  113. endef
  114. define Package/liblua/install
  115. $(INSTALL_DIR) $(1)/usr/lib
  116. $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.so.* $(1)/usr/lib/
  117. endef
  118. define Package/lua/install
  119. $(INSTALL_DIR) $(1)/usr/bin
  120. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lua $(1)/usr/bin/
  121. endef
  122. define Package/luac/install
  123. $(INSTALL_DIR) $(1)/usr/bin
  124. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luac $(1)/usr/bin/
  125. endef
  126. define Package/lua-examples/install
  127. $(INSTALL_DIR) $(1)/usr/share/lua/examples
  128. $(INSTALL_DATA) $(PKG_BUILD_DIR)/test/*.lua \
  129. $(1)/usr/share/lua/examples/
  130. endef
  131. $(eval $(call HostBuild))
  132. $(eval $(call BuildPackage,liblua))
  133. $(eval $(call BuildPackage,lua))
  134. $(eval $(call BuildPackage,luac))
  135. $(eval $(call BuildPackage,lua-examples))