Makefile 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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 <jow@openwrt.org>
  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. ifneq ($(CONFIG_USE_GLIBC),)
  78. ifeq ($(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),)
  79. TARGET_CFLAGS += -DNO_GETLOGIN
  80. endif
  81. endif
  82. define Build/Compile
  83. $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  84. CC="$(TARGET_CROSS)gcc" \
  85. AR="$(TARGET_CROSS)ar rcu" \
  86. RANLIB="$(TARGET_CROSS)ranlib" \
  87. INSTALL_ROOT=/usr \
  88. CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
  89. MYLDFLAGS="$(TARGET_LDFLAGS)" \
  90. PKG_VERSION=$(PKG_VERSION) \
  91. linux
  92. rm -rf $(PKG_INSTALL_DIR)
  93. mkdir -p $(PKG_INSTALL_DIR)
  94. $(MAKE) -C $(PKG_BUILD_DIR) \
  95. INSTALL_TOP="$(PKG_INSTALL_DIR)/usr" \
  96. install
  97. endef
  98. define Host/Configure
  99. $(SED) 's,"/usr/local/","$(STAGING_DIR_HOST)/",' $(HOST_BUILD_DIR)/src/luaconf.h
  100. endef
  101. ifeq ($(HOST_OS),Darwin)
  102. LUA_OS:=macosx
  103. else
  104. ifeq ($(HOST_OS),FreeBSD)
  105. LUA_OS:=freebsd
  106. else
  107. LUA_OS:=linux
  108. endif
  109. endif
  110. define Host/Compile
  111. $(MAKE) -C $(HOST_BUILD_DIR) \
  112. CC="$(HOSTCC) -std=gnu99" \
  113. $(LUA_OS)
  114. endef
  115. define Host/Install
  116. $(MAKE) -C $(HOST_BUILD_DIR) \
  117. INSTALL_TOP="$(STAGING_DIR_HOST)" \
  118. install
  119. endef
  120. define Build/InstallDev
  121. $(INSTALL_DIR) $(1)/usr/include
  122. $(CP) $(PKG_INSTALL_DIR)/usr/include/lua{,lib,conf}.h $(1)/usr/include/
  123. $(CP) $(PKG_INSTALL_DIR)/usr/include/lauxlib.h $(1)/usr/include/
  124. $(CP) $(PKG_INSTALL_DIR)/usr/include/lnum_config.h $(1)/usr/include/
  125. $(INSTALL_DIR) $(1)/usr/lib
  126. $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.{a,so*} $(1)/usr/lib/
  127. $(LN) liblua.so.$(PKG_VERSION) $(1)/usr/lib/liblualib.so
  128. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  129. $(CP) $(PKG_BUILD_DIR)/etc/lua.pc $(1)/usr/lib/pkgconfig/
  130. endef
  131. define Package/liblua/install
  132. $(INSTALL_DIR) $(1)/usr/lib
  133. $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblua.so.* $(1)/usr/lib/
  134. endef
  135. define Package/lua/install
  136. $(INSTALL_DIR) $(1)/usr/bin
  137. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lua $(1)/usr/bin/
  138. endef
  139. define Package/luac/install
  140. $(INSTALL_DIR) $(1)/usr/bin
  141. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luac $(1)/usr/bin/
  142. endef
  143. define Package/lua-examples/install
  144. $(INSTALL_DIR) $(1)/usr/share/lua/examples
  145. $(INSTALL_DATA) $(PKG_BUILD_DIR)/test/*.lua \
  146. $(1)/usr/share/lua/examples/
  147. endef
  148. $(eval $(call BuildPackage,liblua))
  149. $(eval $(call BuildPackage,lua))
  150. $(eval $(call BuildPackage,luac))
  151. $(eval $(call BuildPackage,lua-examples))
  152. $(eval $(call HostBuild))