generating libraries on the fly
This commit is contained in:
		
							parent
							
								
									60a12b4085
								
							
						
					
					
						commit
						b9238f1e36
					
				
							
								
								
									
										1
									
								
								server/repro/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								server/repro/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| env/libs | ||||
							
								
								
									
										2
									
								
								server/repro/env/libs/libDataPipes.so
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								server/repro/env/libs/libDataPipes.so
									
									
									
									
										vendored
									
									
								
							| @ -1 +1 @@ | ||||
| ../../../../../libraries/DataPipes/build/libDataPipes.so | ||||
| /home/wolverindev/TeaSpeak/server/libraries/DataPipes/out/linux_amd64//lib/libDataPipes.so | ||||
							
								
								
									
										2
									
								
								server/repro/env/libs/libTeaMusic.so
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								server/repro/env/libs/libTeaMusic.so
									
									
									
									
										vendored
									
									
								
							| @ -1 +1 @@ | ||||
| ../../../../MusicBot/libs/libTeaMusic.so | ||||
| /home/wolverindev/TeaSpeak/server/TeaSpeak/MusicBot/libs/libTeaMusic.so | ||||
							
								
								
									
										2
									
								
								server/repro/env/libs/libcrypto.so
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								server/repro/env/libs/libcrypto.so
									
									
									
									
										vendored
									
									
								
							| @ -1 +1 @@ | ||||
| ../../../../../libraries/boringssl/build/crypto/libcrypto.so | ||||
| /home/wolverindev/TeaSpeak/server/libraries/boringssl/out/linux_amd64/crypto/libcrypto.so | ||||
							
								
								
									
										2
									
								
								server/repro/env/libs/libjemalloc.so.2
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								server/repro/env/libs/libjemalloc.so.2
									
									
									
									
										vendored
									
									
								
							| @ -1 +1 @@ | ||||
| ../../../../../libraries/jemalloc/out/libjemalloc.so.2 | ||||
| /home/wolverindev/TeaSpeak/server/libraries/jemalloc/out/linux_amd64/lib/libjemalloc.so.2 | ||||
							
								
								
									
										1
									
								
								server/repro/env/libs/libopus.so.0
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								server/repro/env/libs/libopus.so.0
									
									
									
									
										vendored
									
									
								
							| @ -1 +0,0 @@ | ||||
| /usr/local/lib/libopus.so.0 | ||||
							
								
								
									
										2
									
								
								server/repro/env/libs/libssl.so
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								server/repro/env/libs/libssl.so
									
									
									
									
										vendored
									
									
								
							| @ -1 +1 @@ | ||||
| ../../../../../libraries/boringssl/build/ssl/libssl.so | ||||
| /home/wolverindev/TeaSpeak/server/libraries/boringssl/out/linux_amd64/ssl/libssl.so | ||||
							
								
								
									
										70
									
								
								server/repro/generate_libraries.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										70
									
								
								server/repro/generate_libraries.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,70 @@ | ||||
| #!/bin/bash | ||||
| 
 | ||||
| #Required libraries: | ||||
| # "libssl.so" | ||||
| # "libcrypto.so" | ||||
| # "libDataPipes.so" | ||||
| # "libjemalloc.so.2" | ||||
| # "libsqlite3.so.0" | ||||
| # "libTeaMusic.so" | ||||
| 
 | ||||
| [[ -z "${build_os_type}" ]] && { echo "missing build os type"; exit 1; } | ||||
| [[ -z "${build_os_arch}" ]] && { echo "missing build os arch"; exit 1; } | ||||
| build_path="out/${build_os_type}_${build_os_arch}/" | ||||
| 
 | ||||
| function query_system_link() { | ||||
|     echo "Query for $1" | ||||
|     data=$(ldd ../../../environment/TeaSpeakServer | grep "$1") | ||||
|     # shellcheck disable=SC2206 | ||||
|     data=($data) | ||||
|     library_path=${data[2]} | ||||
| 
 | ||||
|     [[ -z "${library_path}" ]] && { echo "failed to resolve library path for $1"; exit 1; } | ||||
|     [[ "${library_path}" == "not" ]] && { echo "failed to resolve library path for $1"; exit 1; } | ||||
| } | ||||
| 
 | ||||
| cd $(dirname $0) || exit 1 | ||||
| cd env || { echo "failed to enter env"; exit 1; } | ||||
| 
 | ||||
| [[ -d libs ]] && { | ||||
|     rm -r libs || { echo "failed to delete old lib folder"; exit 1; } | ||||
| } | ||||
| mkdir libs || { echo "failed to create lib directory"; exit 1; } | ||||
| cd libs || { echo "failed to enter lib directory"; exit 1; } | ||||
| 
 | ||||
| # Creating symbolic links | ||||
| library_base=$(realpath ../../../../../libraries) | ||||
| echo "$library_base" | ||||
| 
 | ||||
| # Setting up ssl | ||||
| library_path=$(realpath "${library_base}/boringssl/${build_path}/ssl/libssl.so") | ||||
| ln -s "$library_path" . || { echo "failed to link libssl.so"; exit 1; } | ||||
| 
 | ||||
| # Setting up crypto | ||||
| library_path=$(realpath "${library_base}/boringssl/${build_path}/crypto/libcrypto.so") | ||||
| ln -s "$library_path" . || { echo "failed to link libcrypto.so"; exit 1; } | ||||
| 
 | ||||
| # Setting up DataPipes | ||||
| ln -s "${library_base}/DataPipes/${build_path}/lib/libDataPipes.so" . || { echo "failed to link libDataPipes.so"; exit 1; } | ||||
| 
 | ||||
| # Setting up Sqlite3 | ||||
| query_system_link "libsqlite3.so.0" | ||||
| ln -s "${library_path}" . || { echo "failed to link libsqlite3.so.0"; exit 1; } | ||||
| 
 | ||||
| # Setting up jemalloc | ||||
| query_system_link "libjemalloc.so.2" | ||||
| ln -s "${library_path}" . || { echo "failed to link libjemalloc.so.2"; exit 1; } | ||||
| 
 | ||||
| # Setting up TeaMusic | ||||
| library_path=$(realpath "../../../../MusicBot/libs/libTeaMusic.so") | ||||
| ln -s "$library_path" . || { echo "failed to link libTeaMusic.so"; exit 1; } | ||||
| 
 | ||||
| # Validate setup | ||||
| broken_links=$(find . -type l ! -exec test -e {} \; -print) | ||||
| [[ -n ${broken_links} ]] && { | ||||
|     echo "Failed to setup all links. Some seem to be broken:" | ||||
|     echo "$broken_links" | ||||
|     exit 1 | ||||
| } | ||||
| 
 | ||||
| echo "All libraries have been linked successfully" | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user