Initial commit
This commit is contained in:
+97
@@ -0,0 +1,97 @@
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/windows,linux,macos,visualstudiocode
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=windows,linux,macos,visualstudiocode
|
||||
|
||||
### Linux ###
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
### macOS ###
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
### macOS Patch ###
|
||||
# iCloud generated files
|
||||
*.icloud
|
||||
|
||||
### VisualStudioCode ###
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
!.vscode/*.code-snippets
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Built Visual Studio Code Extensions
|
||||
*.vsix
|
||||
|
||||
### VisualStudioCode Patch ###
|
||||
# Ignore all local history of files
|
||||
.history
|
||||
.ionide
|
||||
|
||||
### Windows ###
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/windows,linux,macos,visualstudiocode
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Alexander Loren (omgitsalexl)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
name: "Collect Linux Dependencies"
|
||||
description: "Copies an executable's required non-system shared libraries to an artifact directory"
|
||||
|
||||
inputs:
|
||||
executable:
|
||||
description: "Path to the executable"
|
||||
required: true
|
||||
|
||||
output:
|
||||
description: "Artifact output directory"
|
||||
required: false
|
||||
default: "artifacts"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
|
||||
steps:
|
||||
- name: Collect dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
"${{ github.action_path }}/collect.sh" "${{ inputs.executable }}" "${{ inputs.output }}"
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
EXE_PATH="$1"
|
||||
ARTIFACT_PATH="${2:-artifacts}"
|
||||
|
||||
if [ ! -f "$EXE_PATH" ]; then
|
||||
echo "Executable does not exist: $EXE_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$ARTIFACT_PATH"
|
||||
|
||||
declare -A PROCESSED
|
||||
|
||||
is_system_library() {
|
||||
local name
|
||||
name="$(basename "$1")"
|
||||
|
||||
case "$name" in
|
||||
libc.so|libc.so.*)
|
||||
return 0
|
||||
;;
|
||||
|
||||
libm.so|libm.so.*)
|
||||
return 0
|
||||
;;
|
||||
|
||||
libpthread.so|libpthread.so.*)
|
||||
return 0
|
||||
;;
|
||||
|
||||
libdl.so|libdl.so.*)
|
||||
return 0
|
||||
;;
|
||||
|
||||
librt.so|librt.so.*)
|
||||
return 0
|
||||
;;
|
||||
|
||||
ld-linux*.so|ld-linux*.so.*)
|
||||
return 0
|
||||
;;
|
||||
|
||||
libgcc_s.so|libgcc_s.so.*)
|
||||
return 0
|
||||
;;
|
||||
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_dependencies() {
|
||||
local binary="$1"
|
||||
|
||||
ldd "$binary" |
|
||||
awk '
|
||||
/=> \// {
|
||||
print $3
|
||||
next
|
||||
}
|
||||
|
||||
/^\// {
|
||||
print $1
|
||||
}
|
||||
' |
|
||||
sort -u
|
||||
}
|
||||
|
||||
copy_dependency() {
|
||||
local dependency="$1"
|
||||
|
||||
local requested_name
|
||||
requested_name="$(basename "$dependency")"
|
||||
|
||||
local resolved_path
|
||||
resolved_path="$(readlink -f "$dependency")"
|
||||
|
||||
local destination
|
||||
destination="$ARTIFACT_PATH/$requested_name"
|
||||
|
||||
if [ ! -f "$destination" ]; then
|
||||
echo "Copying dependency: $dependency"
|
||||
cp "$resolved_path" "$destination"
|
||||
fi
|
||||
}
|
||||
|
||||
copy_dependencies() {
|
||||
local binary="$1"
|
||||
|
||||
while IFS= read -r dependency; do
|
||||
[ -z "$dependency" ] && continue
|
||||
[ ! -f "$dependency" ] && continue
|
||||
|
||||
if [[ -n "${PROCESSED[$dependency]:-}" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
PROCESSED["$dependency"]=1
|
||||
|
||||
if is_system_library "$dependency"; then
|
||||
echo "Skipping Linux system dependency: $dependency"
|
||||
continue
|
||||
fi
|
||||
|
||||
copy_dependency "$dependency"
|
||||
copy_dependencies "$dependency"
|
||||
|
||||
done < <(get_dependencies "$binary")
|
||||
}
|
||||
|
||||
copy_dependencies "$EXE_PATH"
|
||||
Reference in New Issue
Block a user