Makefile 4.1 KB

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