node10.spec 6.3 KB

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