Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 05e7e1f8d7 | |||
| 220b5a81d3 |
+10
@@ -0,0 +1,10 @@
|
||||
LICENSE
|
||||
|
||||
Files referenced within this project are the copyrighted works of their respective owners, who reserve all rights. Copies, diagrams, and information provided here is believed to be protected use. Besides that, virtually everything mentioned in this project is an open or permissive source program anyway.
|
||||
|
||||
## Licensed Content Created For This Project
|
||||
|
||||
The original works of this project primarily consist of:
|
||||
|
||||
1) Build scripts to automate static/portable builds
|
||||
2) Commentary about the software, how it works, or what it's useful for.
|
||||
@@ -8,6 +8,13 @@ date: "2026-05-09"
|
||||
|
||||
Static Binaries and Repositories
|
||||
|
||||
## Binary List
|
||||
|
||||
- [fio-io_uring](./io-io_uring) - fio-3.42 static linked with support IO_URING
|
||||
|
||||
## Project Layout
|
||||
|
||||
Static binaries go in the root so they're easy to find. Build scripts live under build/.
|
||||
|
||||
## Similar Projects for Reference
|
||||
|
||||
|
||||
Executable
+141
@@ -0,0 +1,141 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
|
||||
# For xnvme support, meson build system is required
|
||||
# https://github.com/xnvme/xnvme
|
||||
|
||||
# Rebuilds a static Linux AMD64 fio binary with io_uring support.
|
||||
# Output binary path: ./fio
|
||||
|
||||
# Directory where this script is located
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
TARGET_DIR="$SCRIPT_DIR/../../"
|
||||
|
||||
lastWORK_DIR=''
|
||||
WORK_DIR=''
|
||||
cd "$TARGET_DIR"
|
||||
source "${TARGET_DIR}/lib/trim.sh"
|
||||
|
||||
|
||||
createOrSetWorkDir()
|
||||
{
|
||||
# Check if previous WORK_DIR already set
|
||||
if [ -f ".WORK_DIR" ]; then
|
||||
lastWORK_DIR=$(cat .WORK_DIR)
|
||||
fi
|
||||
|
||||
if [ ! -d "$lastWORK_DIR" ]; then
|
||||
lastWORK_DIR=""
|
||||
fi
|
||||
|
||||
|
||||
# Either we don't have a previous WORK_DIR or it doesn't exist
|
||||
if [ "$lastWORK_DIR" == "" ]; then
|
||||
|
||||
# printf "%-8s [CREATE]"
|
||||
# Create one
|
||||
declare -g WORK_DIR="$(mktemp -d)"
|
||||
#printf "$WORK_DIR" > .WORK_DIR
|
||||
else
|
||||
# printf "%-8s [OK]"
|
||||
declare -g WORK_DIR="$lastWORK_DIR"
|
||||
fi
|
||||
|
||||
cd "$WORK_DIR"
|
||||
}
|
||||
|
||||
ispinner "Setting up build environment..." &
|
||||
createOrSetWorkDir
|
||||
|
||||
sleep 1
|
||||
|
||||
|
||||
SPIN_PID=$!
|
||||
kill $SPIN_PID
|
||||
|
||||
# echo "[OK]"
|
||||
printf "\b\b\b\b[%s]\n" "" "OK"
|
||||
|
||||
printf "%-4s WORKDR_DIR: %s\n" "" "$WORK_DIR"
|
||||
|
||||
|
||||
printf "%-4s We will now build fio in $WORK_DIR\n" ""
|
||||
printf "%-4s Intermediate files will be deleted on completion\n" ""
|
||||
printf "%-4s and binaries will be deposited in ./%s" " " $(basename "$SCRIPT_DIR")
|
||||
|
||||
|
||||
# Delete the WORK_DIR on exit, so we don't leave a mess
|
||||
trap 'rm -rf "$WORK_DIR"' EXIT
|
||||
|
||||
need_cmd() {
|
||||
if ! command -v "$1" >/dev/null 2>&1; then
|
||||
printf 'error: required command not found: %s\n' "$1" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
need_cmd git
|
||||
need_cmd make
|
||||
need_cmd gcc
|
||||
need_cmd pkg-config
|
||||
need_cmd file
|
||||
need_cmd ldd
|
||||
|
||||
liburing_prefix="$WORK_DIR/liburing-static"
|
||||
|
||||
git clone --depth=1 https://github.com/axboe/liburing.git "$WORK_DIR/liburing"
|
||||
|
||||
|
||||
# If we don't change into the directory, the stuff ends up directly in $WORK_DIR
|
||||
cd "$WORK_DIR/liburing"
|
||||
"$WORK_DIR/liburing/configure" --prefix="$liburing_prefix"
|
||||
make -C "$WORK_DIR/liburing" -j"$(nproc)"
|
||||
|
||||
# There is no actual need to install it
|
||||
# make -C "$WORK_DIR/liburing" install
|
||||
|
||||
printf "Status: %s\n" "$?"
|
||||
echo "Finished building liburing?"
|
||||
# exit
|
||||
|
||||
|
||||
cd "$WORK_DIR"
|
||||
git clone --depth=1 https://github.com/axboe/fio.git "$WORK_DIR/fio-src"
|
||||
|
||||
|
||||
cd "$WORK_DIR/fio-src"
|
||||
export PKG_CONFIG_PATH="${liburing_prefix}/lib/pkgconfig"
|
||||
export PKG_CONFIG="pkg-config --static"
|
||||
|
||||
EXTFLAGS="-static" "$WORK_DIR/fio-src/configure" --disable-native --build-static
|
||||
make -C "$WORK_DIR/fio-src" -j"$(nproc)"
|
||||
|
||||
printf "Status: %s\n" "$?"
|
||||
|
||||
cp "$WORK_DIR/fio-src/fio" "${TARGET_DIR}/fio-io_uring"
|
||||
|
||||
cd "$TARGET_DIR"
|
||||
|
||||
printf 'Verifying static linkage...\n'
|
||||
file ./fio-io_uring
|
||||
ldd ./fio-io_uring || true
|
||||
|
||||
printf 'Verifying io_uring engine...\n'
|
||||
./fio-io_uring --enghelp | grep -E '(^|[[:space:]])io_uring([[:space:]]|$)'
|
||||
|
||||
printf 'Done. Rebuilt binary at %s/fio-io_uring\n' "${TARGET_DIR}"
|
||||
|
||||
|
||||
|
||||
# # Fetching libaio
|
||||
# git clone https://github.com/anlongfei/libaio
|
||||
# cd libaio
|
||||
# make prefix=../build ENABLE_SHARED=false
|
||||
# make prefix=../build ENABLE_SHARED=false install
|
||||
|
||||
# cd ../fio-src/
|
||||
# export PKG_CONFIG_PATH="../build/lib/pkgconfig"
|
||||
# export PKG_CONFIG="pkg-config --static"
|
||||
# EXTFLAGS="-static" ./configure" --disable-native --build-static
|
||||
Executable
BIN
Binary file not shown.
+114
@@ -0,0 +1,114 @@
|
||||
#!/bin/sh
|
||||
|
||||
## COLOR DEFINITIONS
|
||||
# Define colors for usage in prompts. Note that these are escaped for usage
|
||||
# in the prompt and shouldn't be used elsewhere. Read the bash man page to
|
||||
# see why this is necessary
|
||||
export eBLACK='\[\e[0;30m\]'
|
||||
export eBLUE='\[\e[0;34m\]'
|
||||
export eGREEN='\[\e[0;32m\]'
|
||||
export eCYAN='\[\e[0;36m\]'
|
||||
export eRED='\[\e[0;31m\]'
|
||||
export ePURPLE='\[\e[0;35m\]'
|
||||
export eBROWN='\[\e[0;33m\]'
|
||||
export eLIGHTGRAY='\[\e[0;37m\]'
|
||||
export eDARKGRAY='\[\e[1;30m\]'
|
||||
export eLIGHTBLUE='\[\e[1;34m\]'
|
||||
export eLIGHTGREEN='\[\e[1;32m\]'
|
||||
export eLIGHTCYAN='\[\e[1;36m\]'
|
||||
export eLIGHTRED='\[\e[1;31m\]'
|
||||
export eIGHTPURPLE='\[\e[1;35m\]'
|
||||
export eYELLOW='\[\e[1;33m\]'
|
||||
export eWHITE='\[\e[1;37m\]'
|
||||
export eNC='\[\e[0m\]'
|
||||
|
||||
# Define colors for generic usage
|
||||
export BLACK='\e[0;30m'
|
||||
export BLUE='\e[0;34m'
|
||||
export GREEN='\e[0;32m'
|
||||
export CYAN='\e[0;36m'
|
||||
export RED='\e[0;31m'
|
||||
export PURPLE='\e[0;35m'
|
||||
export BROWN='\e[0;33m'
|
||||
export LIGHTGRAY='\e[0;37m'
|
||||
export DARKGRAY='\e[1;30m'
|
||||
export LIGHTBLUE='\e[1;34m'
|
||||
export LIGHTGREEN='\e[1;32m'
|
||||
export LIGHTCYAN='\e[1;36m'
|
||||
export LIGHTRED='\e[1;31m'
|
||||
export LIGHTPURPLE='\e[1;35m'
|
||||
export YELLOW='\e[1;33m'
|
||||
export WHITE='\e[1;37m'
|
||||
export NC='\e[0m'
|
||||
## END COLOR DEFINITIONS
|
||||
|
||||
function ErrorMsg() {
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
|
||||
# Helper function to give informative messages to the user
|
||||
# These are more-or-less based on the similar functions used in Gentoo's
|
||||
# init scripts and portage.
|
||||
|
||||
# Print an informative message to the user on STDERR
|
||||
function emsg() {
|
||||
#echo -e " ${LIGHTGREEN}*$NC $@" 1>&2
|
||||
printf "%b %s\n" " ${LIGHTGREEN}*$NC" "$@" 1>&2
|
||||
}
|
||||
|
||||
# Print a warning message to the user on STDERR
|
||||
function ewarn() {
|
||||
printf "${YELLOW}*$NC %s\n" "${@}" 1>&2
|
||||
}
|
||||
|
||||
# Print an error message to the user on STDERR
|
||||
function eerror() {
|
||||
# echo -e " ${LIGHTRED}*$NC $@" 1>&2
|
||||
printf "${LIGHTRED}*$NC %s\n" "${@}" 1>&2
|
||||
}
|
||||
|
||||
kspinner() {
|
||||
local pid=$1
|
||||
local delay=0.1
|
||||
# Define frames as an array of colored characters
|
||||
local spinstr=( $'\e[31m|\e[0m' $'\e[32m/\e[0m' $'\e[33m-\e[0m' $'\e[34m\\\e[0m' )
|
||||
local i=0
|
||||
|
||||
while kill -0 "$pid" 2>/dev/null; do
|
||||
# Access the array element at index i
|
||||
# Use %s because the element contains multiple characters (escape codes)
|
||||
printf "\r [%s] " "${spinstr[i]}"
|
||||
|
||||
# Increment index and wrap around using modulo
|
||||
i=$(( (i + 1) % ${#spinstr[@]} ))
|
||||
|
||||
sleep "$delay"
|
||||
done
|
||||
# Clean up the line when done
|
||||
printf "\r \r"
|
||||
}
|
||||
|
||||
ispinner() {
|
||||
# local pid=$1
|
||||
local status="$1"
|
||||
local delay=0.1
|
||||
# Define frames as an array of colored characters
|
||||
local spinstr=( $'\e[31m|\e[0m' $'\e[32m/\e[0m' $'\e[33m-\e[0m' $'\e[34m\\\e[0m' )
|
||||
local i=0
|
||||
|
||||
while [ 1 = 1 ]; do
|
||||
# Access the array element at index i
|
||||
# Use %s because the element contains multiple characters (escape codes)
|
||||
printf "\r%-60s [%s] " "${status}" "${spinstr[i]}"
|
||||
|
||||
# Increment index and wrap around using modulo
|
||||
i=$(( (i + 1) % ${#spinstr[@]} ))
|
||||
|
||||
sleep "$delay"
|
||||
done
|
||||
# Clean up the line when done
|
||||
printf "\r \r"
|
||||
}
|
||||
|
||||
|
||||
## END OUTPUT FUNCTIONS
|
||||
Reference in New Issue
Block a user