node.spec 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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 7.1.0
  25. %define V_dist 7.1.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: 20161109
  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, pkgconfig
  46. PreReq: OpenPKG, openpkg >= 20160101
  47. BuildPreReq: openssl >= 1.0.2, libexecinfo, zlib, ares, http-parser
  48. PreReq: openssl >= 1.0.2, libexecinfo, zlib, ares, http-parser
  49. %if "%{with_icu}" == "yes"
  50. BuildPreReq: icu
  51. PreReq: icu
  52. %endif
  53. %description
  54. Node.js (V7, non-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.4.500.36.
  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. %if "%{with_icu}" == "yes"
  109. --with-intl=system-icu \
  110. %else
  111. --with-intl=small-icu \
  112. %endif
  113. --without-npm
  114. # build program
  115. %{l_make} %{l_mflags -O}
  116. # build wrapper
  117. %{l_cc} %{l_cflags -O} %{l_cppflags} -DPREFIX="\"%{l_prefix}\"" %{l_ldflags} \
  118. -o node-wrapper %{SOURCE node.c}
  119. %install
  120. # install program
  121. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  122. # install wrapper
  123. %{l_shtool} mkdir -f -p -m 755 \
  124. $RPM_BUILD_ROOT%{l_prefix}/libexec/node
  125. mv $RPM_BUILD_ROOT%{l_prefix}/bin/node \
  126. $RPM_BUILD_ROOT%{l_prefix}/libexec/node/node
  127. %{l_shtool} install -c -s -m 755 \
  128. node-wrapper $RPM_BUILD_ROOT%{l_prefix}/bin/node
  129. # post-installation strip-down
  130. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  131. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/dtrace
  132. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/systemtap
  133. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc
  134. # create NPM package installation areas
  135. %{l_shtool} mkdir -f -p -m 755 \
  136. $RPM_BUILD_ROOT%{l_prefix}/lib/node/usr \
  137. $RPM_BUILD_ROOT%{l_prefix}/lib/node/pkg
  138. # determine installation files
  139. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  140. %files -f files
  141. %clean