node.spec 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. ##
  2. ## node.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2016 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package version
  24. %define V_opkg 6.8.0
  25. %define V_dist 6.8.0
  26. # package information
  27. Name: node
  28. Summary: Node JavaScript Run-Time (V6)
  29. URL: http://nodejs.org/
  30. Vendor: Node Foundation
  31. Packager: OpenPKG Foundation e.V.
  32. Distribution: OpenPKG Community
  33. Class: PLUS
  34. Group: Web
  35. License: MIT/BSD
  36. Version: %{V_opkg}
  37. Release: 20161014
  38. # package options
  39. %option with_icu yes
  40. # list of sources
  41. Source0: https://nodejs.org/download/release/v%{V_dist}/node-v%{V_dist}.tar.xz
  42. Source1: node.c
  43. Patch0: node.patch
  44. # build information
  45. BuildPreReq: OpenPKG, openpkg >= 20160101, make, gcc >= 5.2, gcc::with_cxx = yes, python
  46. PreReq: OpenPKG, openpkg >= 20160101
  47. BuildPreReq: openssl >= 1.0.2, libexecinfo, zlib, ares, libuv, http-parser
  48. PreReq: openssl >= 1.0.2, libexecinfo, zlib, ares, libuv, http-parser
  49. %if "%{with_icu}" == "yes"
  50. BuildPreReq: icu
  51. PreReq: icu
  52. %endif
  53. %description
  54. Node.js (V6, LTS) provides an easy way to build scalable network
  55. servers in JavaScript. It is an event-driven I/O environment based
  56. on Google V8 JavaScript virtual machine version 5.1.281.81.
  57. %track
  58. prog node = {
  59. version = %{V_dist}
  60. url = https://nodejs.org/download/release/
  61. regex = v(\d+\.\d+\.\d+)/
  62. }
  63. %prep
  64. %setup -q -n node-v%{V_dist}
  65. %patch -p0
  66. %build
  67. # provide local tool wrapper scripts as we cannot
  68. # reliably pass the includes via configure variables
  69. includes="-I`pwd`/deps/v8 -I`pwd`/deps/v8/include %{l_cppflags}"
  70. mkdir tool
  71. for tool in gcc g++ c%{l_nil}c c++; do
  72. ( echo "#!/bin/sh"
  73. echo "exec %{l_prefix}/bin/$tool $includes \${1+\"\$@\"}"
  74. ) >tool/$tool
  75. chmod a+x tool/$tool
  76. done
  77. PATH="`pwd`/tool:$PATH"
  78. # configure program
  79. libs="-lexecinfo -lz"
  80. case "%{l_platform -t} " in
  81. *-linux* ) libs="$libs -ldl" ;;
  82. esac
  83. CC="gcc" \
  84. CXX="g++" \
  85. CFLAGS="%{l_cflags -O}" \
  86. CXXFLAGS="%{l_cxxflags -O} -Wno-deprecated-declarations" \
  87. CPPFLAGS="%{l_cppflags}" \
  88. LDFLAGS="%{l_ldflags}" \
  89. LIBS="$libs" \
  90. %{l_prefix}/bin/python ./configure \
  91. --prefix=%{l_prefix} \
  92. --shared-openssl \
  93. --shared-openssl-includes=%{l_prefix}/include \
  94. --shared-openssl-libpath=%{l_prefix}/lib \
  95. --shared-openssl-libname="ssl,crypto" \
  96. --shared-zlib \
  97. --shared-zlib-includes=%{l_prefix}/include \
  98. --shared-zlib-libpath=%{l_prefix}/lib \
  99. --shared-zlib-libname="z" \
  100. --shared-http-parser \
  101. --shared-http-parser-includes=%{l_prefix}/include \
  102. --shared-http-parser-libpath=%{l_prefix}/lib \
  103. --shared-http-parser-libname="http_parser" \
  104. --shared-cares \
  105. --shared-cares-includes=%{l_prefix}/include \
  106. --shared-cares-libpath=%{l_prefix}/lib \
  107. --shared-cares-libname="ares" \
  108. --shared-libuv \
  109. --shared-libuv-includes=%{l_prefix}/include \
  110. --shared-libuv-libpath=%{l_prefix}/lib \
  111. --shared-libuv-libname="uv" \
  112. %if "%{with_icu}" == "yes"
  113. --with-intl=system-icu \
  114. %else
  115. --with-intl=small-icu \
  116. %endif
  117. --without-npm
  118. # build program
  119. %{l_make} %{l_mflags -O}
  120. # build wrapper
  121. %{l_cc} %{l_cflags -O} %{l_cppflags} -DPREFIX="\"%{l_prefix}\"" %{l_ldflags} \
  122. -o node-wrapper %{SOURCE node.c}
  123. %install
  124. # install program
  125. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  126. # install wrapper
  127. %{l_shtool} mkdir -f -p -m 755 \
  128. $RPM_BUILD_ROOT%{l_prefix}/libexec/node
  129. mv $RPM_BUILD_ROOT%{l_prefix}/bin/node \
  130. $RPM_BUILD_ROOT%{l_prefix}/libexec/node/node
  131. %{l_shtool} install -c -s -m 755 \
  132. node-wrapper $RPM_BUILD_ROOT%{l_prefix}/bin/node
  133. # post-installation strip-down
  134. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  135. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/dtrace
  136. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/systemtap
  137. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc
  138. # create NPM package installation areas
  139. %{l_shtool} mkdir -f -p -m 755 \
  140. $RPM_BUILD_ROOT%{l_prefix}/lib/node/usr \
  141. $RPM_BUILD_ROOT%{l_prefix}/lib/node/pkg
  142. # determine installation files
  143. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  144. %files -f files
  145. %clean