mirror of
				https://github.com/key-networks/ztncui.git
				synced 2024-08-31 04:28:00 +00:00 
			
		
		
		
	Static linking libstdc++ to argon2.node to remove dependency on shared lib
This commit is contained in:
		
							parent
							
								
									fdce206bcc
								
							
						
					
					
						commit
						d8174f3b5b
					
				
							
								
								
									
										1
									
								
								build/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								build/.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1,2 +1,3 @@
 | 
			
		||||
Release/
 | 
			
		||||
Staging/
 | 
			
		||||
ztncui
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										11
									
								
								build/after-install.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										11
									
								
								build/after-install.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,11 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
ETC='/opt/key-networks/ztncui/etc'
 | 
			
		||||
 | 
			
		||||
echo "Copying default password file..."
 | 
			
		||||
cp -v $ETC/default.passwd $ETC/passwd
 | 
			
		||||
if [ $? -eq 0 ]; then
 | 
			
		||||
  exit 0
 | 
			
		||||
else
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
							
								
								
									
										10
									
								
								build/binding.gyp.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								build/binding.gyp.patch
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
			
		||||
--- binding.gyp	2016-11-30 05:56:09.000000000 +0800
 | 
			
		||||
+++ /home/srp/dev/node/ztncui/build/binding.gyp	2018-01-04 12:39:02.266078387 +0800
 | 
			
		||||
@@ -42,6 +42,7 @@
 | 
			
		||||
         "<!(node -e \"require('nan')\")",
 | 
			
		||||
         "argon2/include"
 | 
			
		||||
       ],
 | 
			
		||||
+      "libraries": ["/usr/lib/gcc/x86_64-redhat-linux/7/libstdc++.a"],
 | 
			
		||||
       "dependencies": ["libargon2"],
 | 
			
		||||
       "configurations": {
 | 
			
		||||
         "Debug": {
 | 
			
		||||
@ -1,6 +1,10 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
set -eux -o pipefail
 | 
			
		||||
THISDIR=`pwd`
 | 
			
		||||
if [ `basename $THISDIR`  != 'build' ]; then
 | 
			
		||||
  echo "Execute `basename $0` from the build directory"
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
SRC_DIR=../src
 | 
			
		||||
BUILD_DIR=`pwd`
 | 
			
		||||
@ -15,14 +19,42 @@ MAINTAINER='https://key-networks.com/contact'
 | 
			
		||||
URL='https://key-networks.com'
 | 
			
		||||
LICENSE='GPLv3'
 | 
			
		||||
 | 
			
		||||
BINDINGGYP='node_modules/argon2/binding.gyp'
 | 
			
		||||
 | 
			
		||||
if [ ! -f  /usr/lib/gcc/x86_64-redhat-linux/7/libstdc++.a ]; then
 | 
			
		||||
  echo "You must install libstdc++-static"
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
rm -fr $STAGING_DIR && mkdir $STAGING_DIR
 | 
			
		||||
rm -fr $PKG_DIR && mkdir $PKG_DIR
 | 
			
		||||
 | 
			
		||||
pushd .
 | 
			
		||||
cd ../src
 | 
			
		||||
pushd .
 | 
			
		||||
npm install
 | 
			
		||||
pkg -c ./package.json -t node8-linux-x64 bin/www -o ztncui
 | 
			
		||||
cd -
 | 
			
		||||
 | 
			
		||||
patch --forward --dry-run --silent $BINDINGGYP $BUILD_DIR/binding.gyp.patch
 | 
			
		||||
if [ $? -eq 0 ]; then
 | 
			
		||||
  echo "Applying patch to $BINDINGGYP..."
 | 
			
		||||
  patch --forward $BINDINGGYP $BUILD_DIR/binding.gyp.patch
 | 
			
		||||
fi
 | 
			
		||||
if [ $? -ne 0 ]; then
 | 
			
		||||
  echo "Failed to patch $BINDINGGYP"
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
cd node_modules/argon2/
 | 
			
		||||
node-gyp rebuild
 | 
			
		||||
if [ $? -ne 0 ]; then
 | 
			
		||||
  echo "Failed to rebuild argon2"
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
popd
 | 
			
		||||
pkg -c ./package.json -t node8-linux-x64 bin/www -o $BUILD_DIR/ztncui
 | 
			
		||||
 | 
			
		||||
popd
 | 
			
		||||
 | 
			
		||||
install -m 750 -d $STAGING_DIR/opt
 | 
			
		||||
install -m 750 -d $STAGING_DIR/opt/key-networks
 | 
			
		||||
@ -32,7 +64,7 @@ install -m 600 $SRC_DIR/etc/default.passwd $STAGING_DIR/opt/key-networks/ztncui/
 | 
			
		||||
install -m 750 -d $STAGING_DIR/opt/key-networks/ztncui/etc/tls
 | 
			
		||||
install -m 750 -d $STAGING_DIR/opt/key-networks/ztncui/node_modules/argon2/build/Release
 | 
			
		||||
install -m 755 $SRC_DIR/node_modules/argon2/build/Release/argon2.node $STAGING_DIR/opt/key-networks/ztncui/node_modules/argon2/build/Release/
 | 
			
		||||
install -m 755 $SRC_DIR/ztncui $STAGING_DIR/opt/key-networks/ztncui/
 | 
			
		||||
install -m 755 $BUILD_DIR/ztncui $STAGING_DIR/opt/key-networks/ztncui/
 | 
			
		||||
 | 
			
		||||
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout $STAGING_DIR/opt/key-networks/ztncui/etc/tls/privkey.pem -out $STAGING_DIR/opt/key-networks/ztncui/etc/tls/fullchain.pem -config $BUILD_DIR/openssl.cnf
 | 
			
		||||
 | 
			
		||||
@ -44,7 +76,7 @@ GENERAL_FPM_FLAGS="
 | 
			
		||||
  --chdir $STAGING_DIR
 | 
			
		||||
  --package $PKG_DIR
 | 
			
		||||
  --directories /opt/key-networks
 | 
			
		||||
  --after-install /dev/null
 | 
			
		||||
  --after-install after-install.sh
 | 
			
		||||
  --before-install /dev/null
 | 
			
		||||
  --after-remove /dev/null
 | 
			
		||||
  --before-remove /dev/null
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user