node9.spec 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. ##
  2. ## node9.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2017 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_snap_base 9.0.0
  25. %define V_snap_type nightly
  26. %define V_snap_date 20171006
  27. %define V_snap_hash 4f339b54e9
  28. %define V_opkg %{V_snap_base}.%{V_snap_date}
  29. %define V_dist %{V_snap_base}-%{V_snap_type}%{V_snap_date}%{V_snap_hash}
  30. # package information
  31. Name: node9
  32. Summary: Node JavaScript Run-Time (V9)
  33. URL: http://nodejs.org/
  34. Vendor: Node Foundation
  35. Packager: OpenPKG Foundation e.V.
  36. Distribution: OpenPKG Community
  37. Class: PLUS
  38. Group: Web
  39. License: MIT/BSD
  40. Version: %{V_opkg}
  41. Release: 20171007
  42. # package options
  43. %option with_icu yes
  44. %option with_node no
  45. # list of sources
  46. Source0: https://nodejs.org/download/%{V_snap_type}/v%{V_dist}/node-v%{V_dist}.tar.xz
  47. Source1: node.c
  48. Patch0: node9.patch
  49. # build information
  50. BuildPreReq: OpenPKG, openpkg >= 20160101, make, gcc >= 5.2, gcc::with_cxx = yes, python, pkgconfig
  51. PreReq: OpenPKG, openpkg >= 20160101
  52. BuildPreReq: openssl >= 1.0.2, libexecinfo, zlib, ares, http-parser
  53. PreReq: openssl >= 1.0.2, libexecinfo, zlib, ares, http-parser
  54. %if "%{with_icu}" == "yes"
  55. BuildPreReq: icu
  56. PreReq: icu
  57. %endif
  58. %if "%{with_node}" == "yes"
  59. Provides: node = %{version}
  60. %endif
  61. %description
  62. Node.js (V9) provides an easy way to build scalable network
  63. servers in JavaScript. It is an event-driven I/O environment based
  64. on Google V8 JavaScript virtual machine version 6.1.534.42.
  65. %track
  66. prog node9:base = {
  67. version = %{V_snap_base}
  68. url = https://nodejs.org/download/%{V_snap_type}/
  69. regex = v(\d+\.\d+\.\d+)-%{V_snap_type}\d{8}[\da-f]{10}/
  70. }
  71. prog node9:date = {
  72. version = %{V_snap_date}
  73. url = https://nodejs.org/download/%{V_snap_type}/
  74. regex = v\d+\.\d+\.\d+-%{V_snap_type}(\d{8})[\da-f]{10}/
  75. }
  76. prog node9:hash = {
  77. version = %{V_snap_hash}
  78. url = https://nodejs.org/download/%{V_snap_type}/
  79. regex = v\d+\.\d+\.\d+-%{V_snap_type}\d{8}([\da-f]{10})/
  80. }
  81. %prep
  82. %setup -q -n node-v%{V_dist}
  83. %patch -p0
  84. %build
  85. # provide local tool wrapper scripts as we cannot
  86. # reliably pass the includes via configure variables
  87. includes="-I`pwd`/deps/v8_inspector -I`pwd`/deps/v8_inspector/include"
  88. includes="$includes -I`pwd`/deps/v8 -I`pwd`/deps/v8/include"
  89. includes="$includes %{l_cppflags}"
  90. mkdir tool
  91. for tool in gcc g++ c%{l_nil}c c++; do
  92. ( echo "#!/bin/sh"
  93. echo "exec %{l_prefix}/bin/$tool $includes \${1+\"\$@\"}"
  94. ) >tool/$tool
  95. chmod a+x tool/$tool
  96. done
  97. PATH="`pwd`/tool:$PATH"
  98. # configure program
  99. libs="-lexecinfo -lz"
  100. case "%{l_platform -t} " in
  101. *-linux* ) libs="$libs -ldl" ;;
  102. esac
  103. CC="gcc" \
  104. CXX="g++" \
  105. CFLAGS="%{l_cflags -O}" \
  106. CXXFLAGS="%{l_cxxflags -O} -Wno-deprecated-declarations" \
  107. CPPFLAGS="%{l_cppflags}" \
  108. LDFLAGS="%{l_ldflags}" \
  109. LIBS="$libs" \
  110. %{l_prefix}/bin/python ./configure \
  111. --prefix=%{l_prefix} \
  112. --shared-openssl \
  113. --shared-openssl-includes=%{l_prefix}/include \
  114. --shared-openssl-libpath=%{l_prefix}/lib \
  115. --shared-openssl-libname="ssl,crypto" \
  116. --shared-zlib \
  117. --shared-zlib-includes=%{l_prefix}/include \
  118. --shared-zlib-libpath=%{l_prefix}/lib \
  119. --shared-zlib-libname="z" \
  120. --shared-http-parser \
  121. --shared-http-parser-includes=%{l_prefix}/include \
  122. --shared-http-parser-libpath=%{l_prefix}/lib \
  123. --shared-http-parser-libname="http_parser" \
  124. --shared-cares \
  125. --shared-cares-includes=%{l_prefix}/include \
  126. --shared-cares-libpath=%{l_prefix}/lib \
  127. --shared-cares-libname="ares" \
  128. %if "%{with_icu}" == "yes"
  129. --with-intl=system-icu \
  130. %else
  131. --with-intl=small-icu \
  132. %endif
  133. --without-snapshot \
  134. --without-npm
  135. # build program
  136. %{l_make} %{l_mflags -O}
  137. # build wrapper
  138. %{l_cc} %{l_cflags -O} %{l_cppflags} -DPREFIX="\"%{l_prefix}\"" %{l_ldflags} \
  139. -o node-wrapper %{SOURCE node.c}
  140. %install
  141. # install program
  142. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  143. # install wrapper
  144. %{l_shtool} mkdir -f -p -m 755 \
  145. $RPM_BUILD_ROOT%{l_prefix}/libexec/node9
  146. mv $RPM_BUILD_ROOT%{l_prefix}/bin/node \
  147. $RPM_BUILD_ROOT%{l_prefix}/libexec/node9/node
  148. %{l_shtool} install -c -s -m 755 \
  149. node-wrapper $RPM_BUILD_ROOT%{l_prefix}/bin/node
  150. # post-installation strip-down
  151. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  152. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/dtrace
  153. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/systemtap
  154. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc
  155. %if "%{with_node}" == "yes"
  156. # create NPM package installation areas
  157. %{l_shtool} mkdir -f -p -m 755 \
  158. $RPM_BUILD_ROOT%{l_prefix}/lib/node/usr \
  159. $RPM_BUILD_ROOT%{l_prefix}/lib/node/pkg
  160. %endif
  161. # post-adjust installation
  162. mv $RPM_BUILD_ROOT%{l_prefix}/bin/node \
  163. $RPM_BUILD_ROOT%{l_prefix}/bin/node9
  164. mv $RPM_BUILD_ROOT%{l_prefix}/include/node \
  165. $RPM_BUILD_ROOT%{l_prefix}/include/node9
  166. mv $RPM_BUILD_ROOT%{l_prefix}/man/man1/node.1 \
  167. $RPM_BUILD_ROOT%{l_prefix}/man/man1/node9.1
  168. %if "%{with_node}" == "yes"
  169. # shim as Node
  170. ln -s node9 $RPM_BUILD_ROOT%{l_prefix}/bin/node
  171. ln -s node9 $RPM_BUILD_ROOT%{l_prefix}/include/node
  172. ln -s node9.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/node.1
  173. %endif
  174. # determine installation files
  175. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  176. %files -f files
  177. %clean