aboutsummaryrefslogblamecommitdiffstats
path: root/main/nodejs/APKBUILD
blob: 9607141259cbc379517e8dd9a5058b5e4d8a5043 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                                                    
                                               
                                                  
                                                
                                         
                                              

           

                      

                     


                      

                      


                     

                     


                     



                      



                      








                     

                     





                      

                      



                        



                     






                        
 


                                                                    
              
        
                                                             
                         
                                     
             
                                            
             
                  
                  
               


                     
               

                

                                       
                                                                            

                                                                             
                                                             
                                                

                                           
                                
 
           
                       
 
                                                           
                                                            

 
         
                                                  








                                                                              
 



                                                                                     



                                                                                
         



                                                                               

                                                                         
                                            
                              
                                 
                               
                                  
                                
                                  

                                                                        

                                       
 
                              







                                                                             


           
                                      
 
 

                                                                       
                   

 
            
                                                                                                                                                      
                                                                                                                                                                          

                                                                                                                                                                     
# Contributor: Jose-Luis Rivas <ghostbar@riseup.net>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Contributor: Dave Esaias <dave@containership.io>
# Contributor: Tadahisa Kamijo <kamijin@live.jp>
# Contributor: Eivind Uggedal <eu@eju.no>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
#
# secfixes:
#   14.17.4-r0:
#     - CVE-2021-22930
#   14.16.1-r0:
#     - CVE-2020-7774
#   14.16.0-r0:
#     - CVE-2021-22883
#     - CVE-2021-22884
#   14.15.5-r0:
#     - CVE-2021-21148
#   14.15.4-r0:
#     - CVE-2020-8265
#     - CVE-2020-8287
#   14.15.1-r0:
#     - CVE-2020-8277
#   12.18.4-r0:
#     - CVE-2020-8201
#     - CVE-2020-8252
#   12.18.0-r0:
#     - CVE-2020-8172
#     - CVE-2020-11080
#     - CVE-2020-8174
#   12.15.0-r0:
#     - CVE-2019-15606
#     - CVE-2019-15605
#     - CVE-2019-15604
#   10.16.3-r0:
#     - CVE-2019-9511
#     - CVE-2019-9512
#     - CVE-2019-9513
#     - CVE-2019-9514
#     - CVE-2019-9515
#     - CVE-2019-9516
#     - CVE-2019-9517
#     - CVE-2019-9518
#   10.15.3-r0:
#     - CVE-2019-5737
#   10.14.0-r0:
#     - CVE-2018-12121
#     - CVE-2018-12122
#     - CVE-2018-12123
#     - CVE-2018-0735
#     - CVE-2018-0734
#   8.11.4-r0:
#     - CVE-2018-12115
#   8.11.3-r0:
#     - CVE-2018-7167
#     - CVE-2018-7161
#     - CVE-2018-1000168
#   8.11.0-r0:
#     - CVE-2018-7158
#     - CVE-2018-7159
#     - CVE-2018-7160
#   8.9.3-r0:
#     - CVE-2017-15896
#     - CVE-2017-15897
#   6.11.5-r0:
#     - CVE-2017-14919
#   6.11.1-r0:
#     - CVE-2017-1000381
#
pkgname=nodejs
# Note: Update only to even-numbered versions (e.g. 6.y.z, 8.y.z)!
# Odd-numbered versions are supported only for 9 months by upstream.
pkgver=14.17.4
pkgrel=0
pkgdesc="JavaScript runtime built on V8 engine - LTS version"
url="https://nodejs.org/"
arch="all !mips64 !mips64el !riscv64"
license="MIT"
depends="ca-certificates nghttp2-libs>=1.41"
makedepends="
	brotli-dev
	c-ares-dev
	icu-dev
	linux-headers
	nghttp2-dev
	openssl-dev
	python3
	zlib-dev
	"
install="$pkgname.post-upgrade"
subpackages="$pkgname-dev $pkgname-doc"
provider_priority=100  # highest priority (other provider is nodejs-current)
provides="nodejs-lts=$pkgver"  # for backward compatibility
replaces="nodejs-current nodejs-lts"  # nodejs-lts for backward compatibility
source="https://nodejs.org/dist/v$pkgver/node-v$pkgver.tar.gz
	disable-running-gyp-on-shared-deps.patch
	link-with-libatomic-on-mips32.patch
	"
builddir="$srcdir/node-v$pkgver"

prepare() {
	default_prepare

	# Remove bundled dependencies that we're not using.
	rm -rf deps/brotli deps/cares deps/openssl deps/zlib
}

build() {
	# Add defines recommended in libuv readme.
	local common_flags="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"

	# Compiling with O2 instead of Os increases binary size by ~10%
	# (53.1 MiB -> 58.6 MiB), but also increases performance by ~20%
	# according to v8/web-tooling-benchmark. Node.js is quite huge anyway;
	# there are better options for size constrained environments.
	export CFLAGS="${CFLAGS/-Os/-O2} $common_flags"
	export CXXFLAGS="${CXXFLAGS/-Os/-O2} $common_flags"
	export CPPFLAGS="${CPPFLAGS/-Os/-O2} $common_flags"

	case "$CARCH" in
	mips*) _carchflags="--with-mips-arch-variant=r1 --with-mips-float-abi=soft";;
	esac

	# NOTE: We use bundled libuv because they don't care much about backward
	# compatibility and it has happened several times in past that we
	# couldn't upgrade nodejs package in stable branches to fix CVEs due to
	# libuv incompatibility.
	#
	# NOTE: We don't package the bundled npm - it's a separate project with
	# its own release cycle and version numbering, so it's better to keep
	# it in a standalone aport.
	#
	# TODO: After icu package is modified to split data into multiple
	# variants, change --with-intl to "system-icu".
	python3 configure.py --prefix=/usr \
		$_carchflags \
		--shared-brotli \
		--shared-zlib \
		--shared-openssl \
		--shared-cares \
		--shared-nghttp2 \
		--openssl-use-def-ca-store \
		--with-icu-default-data-dir=$(icu-config --icudatadir) \
		--with-intl=small-icu \
		--without-npm

	make BUILDTYPE=Release
}

# TODO Run provided test suite.
check() {
	cd "$builddir"/out/Release

	./node -e 'console.log("Hello, world!")'
	./node -e "require('assert').equal(process.versions.node, '$pkgver')"
}

package() {
	make DESTDIR="$pkgdir" install
}

dev() {
	provides="nodejs-lts-dev=$pkgver"  # for backward compatibility
	default_dev
}

sha512sums="
c6b574e5a3ee3329cc069bd1d556076e2002ba29ea3788aaa09fb669be13588adf783a2f179d0fcd8b17513979f39078d0a403b56f61fb9022652c2c3dcdbbd8  node-v14.17.4.tar.gz
dbe8167b61518f8f59176759d69834d57bf3e6a5a5fd3dfc2359cafe0325da08b27f8220d278ed77f50c9f63a03313eabbbb0eaca3e592e5bb4e0d5be0ced373  disable-running-gyp-on-shared-deps.patch
44e81fbf254bd79e38b813f7f5a1336df854588939cba50aaec600660495f9b7745a7049a99eb59d15a51100b3a44f66892a902d7fc32e1399b51883ad4c02cf  link-with-libatomic-on-mips32.patch
"