Skip to content

Instantly share code, notes, and snippets.

@tresf
Last active June 4, 2025 16:52
Show Gist options
  • Save tresf/b00fd445ca90742b09af1b315d092eae to your computer and use it in GitHub Desktop.
Save tresf/b00fd445ca90742b09af1b315d092eae to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
versions=(
"2.10.1-alpha1"
"2.10.0"
"2.9.6"
"2.9.5"
"2.9.4"
"2.9.3"
#"2.9.2" # skip, archive seems broken
"2.9.1"
"2.9.0"
"2.8.0"
"2.6.0"
"2.5.0"
"0.9.0"
)
print_glibc_versions() {
echo "$1:"
if [ -d "$2/libs/linux" ]; then
# old structure
for file in "$2/libs/linux/"*; do
system="$(basename "$file" | cut -d_ -f2- | cut -d. -f1)"
glibc="$(objdump -T "$file" | grep -Eo 'GLIBC_\S+' | sort -u |tail -1|tr -d ")")"
echo "- linux_$system: $glibc"
done
else
# new structure
for dir in "$2/natives/linux_"*; do
system="$(basename "$dir")"
glibc="$(objdump -T "$dir/"*.so | grep -Eo 'GLIBC_\S+' | sort -u |tail -1|tr -d ")")"
echo "- $system: $glibc"
done
fi
echo ""
}
for version in ${versions[@]}; do
# Predict zip files when version < 2.9
major=$(echo "$version"|cut -d'.' -f1)
minor=$(echo "$version"|cut -d'.' -f2)
if (( $(echo "$major >= 2" | bc -l) )); then
if (( $(echo "$minor >= 9" | bc -l) )); then
url="https://github.com/java-native/jssc/releases/download/v$version/jssc-$version.jar"
jar="./jssc-$version.jar"
extracted="./jssc-$version"
if [ -f "$jar" ]; then
echo "Skipping download of $url" > /dev/null
else
wget -q "$url" -O "$jar"
rm -rf "$extracted" > /dev/null && mkdir "$extracted" > /dev/null
unzip "$jar" -d "$extracted" > /dev/null
fi
print_glibc_versions "$version" "$extracted"
continue
fi
fi
# Legacy: Unzip before extracting jar
url="https://github.com/java-native/jssc/releases/download/v$version/jssc-$version.zip"
zip="./jssc-$version.zip"
jar="./jssc-$version.jar"
extracted="./jssc-$version"
if [ -f "$jar" ]; then
echo "Skipping download of $url" > /dev/null
else
wget -q "$url" -O "$zip"
rm -rf "$extracted-zip" > /dev/null && mkdir "$extracted-zip" > /dev/null
unzip "$zip" -d "$extracted-zip" > /dev/null
rm -f "$zip"
mv "$extracted-zip/jSSC-$version-Release/jssc.jar" "$jar"
rm -rf "$extracted-zip" > /dev/null
rm -rf "$extracted" > /dev/null && mkdir "$extracted" > /dev/null
unzip "$jar" -d "$extracted" > /dev/null
fi
print_glibc_versions "$version" "$extracted"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment