Add some scripts for investigating the ports tree options.
This commit is contained in:
parent
5e81006208
commit
a6af4eee2f
26
ansible/roles/build/files/find_packages_that_installed_kernel_modules.bash
Executable file
26
ansible/roles/build/files/find_packages_that_installed_kernel_modules.bash
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# List installed packages that install a kernel module.
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
: ${PORTSDIR:="/usr/ports"}
|
||||||
|
|
||||||
|
function main {
|
||||||
|
if [ "$#" -ne 0 ]; then
|
||||||
|
(>&2 echo "This script takes no positional parameters.")
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
local module
|
||||||
|
doas find / -type f -name '*.ko' | sort | while read module; do
|
||||||
|
local provides=$(pkg provides "$module")
|
||||||
|
if [ -n "$provides" ]; then
|
||||||
|
package_name=$(grep 'Name : ' <<<"$provides" | sed 's/Name : //g')
|
||||||
|
# module_file=$(grep 'Filename: ' <<<"$provides" | sed 's/Filename: //g')
|
||||||
|
echo "$package_name"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
main "${@}"
|
36
ansible/roles/build/files/find_popular_ports_options.bash
Executable file
36
ansible/roles/build/files/find_popular_ports_options.bash
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Find which port options appear the most in ports.
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
: ${PORTSDIR:="/usr/ports"}
|
||||||
|
|
||||||
|
function main {
|
||||||
|
if [ "$#" -ne 0 ]; then
|
||||||
|
(>&2 echo "This script takes no positional parameters.")
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
local folder
|
||||||
|
find_port_folders | while read folder; do
|
||||||
|
set +e
|
||||||
|
dump_port_options "$folder"
|
||||||
|
set -e
|
||||||
|
done | sort | uniq -c | sort -nr
|
||||||
|
}
|
||||||
|
|
||||||
|
function find_port_folders {
|
||||||
|
local mf
|
||||||
|
find "$PORTSDIR" -type f -name Makefile -mindepth 3 -maxdepth 3 | sort | while read mf; do
|
||||||
|
dirname "$mf"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function dump_port_options {
|
||||||
|
local folder="$1"
|
||||||
|
local portopts=$(make -C "$folder" -V OPTIONS_DEFINE)
|
||||||
|
echo "$portopts" | grep -oE --line-buffered '[^ ]*'
|
||||||
|
}
|
||||||
|
|
||||||
|
main "${@}"
|
41
ansible/roles/build/files/find_ports_containing_option.bash
Executable file
41
ansible/roles/build/files/find_ports_containing_option.bash
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# List ports containing an option matching the first parameter to the script.
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
: ${PORTSDIR:="/usr/ports"}
|
||||||
|
|
||||||
|
function main {
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
(>&2 echo "Pass exactly 1 option name to this script.")
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
local find_option_name=$1
|
||||||
|
local folder
|
||||||
|
find_port_folders | while read folder; do
|
||||||
|
set +e
|
||||||
|
dump_port_options "$folder" | grep -qE "^${find_option_name}$"
|
||||||
|
has_opt=$?;
|
||||||
|
set -e
|
||||||
|
if [ $has_opt -eq 0 ]; then
|
||||||
|
echo "$folder"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function find_port_folders {
|
||||||
|
local mf
|
||||||
|
find "$PORTSDIR" -type f -name Makefile -mindepth 3 -maxdepth 3 | sort | while read mf; do
|
||||||
|
dirname "$mf"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function dump_port_options {
|
||||||
|
local folder="$1"
|
||||||
|
local portopts=$(make -C "$folder" -V OPTIONS_DEFINE)
|
||||||
|
echo "$portopts" | grep -oE --line-buffered '[^ ]*'
|
||||||
|
}
|
||||||
|
|
||||||
|
main "${@}"
|
@ -92,3 +92,9 @@
|
|||||||
dest: /usr/local/bin/freebsd_update_step1
|
dest: /usr/local/bin/freebsd_update_step1
|
||||||
- src: freebsd_update_step2
|
- src: freebsd_update_step2
|
||||||
dest: /usr/local/bin/freebsd_update_step2
|
dest: /usr/local/bin/freebsd_update_step2
|
||||||
|
- src: find_popular_ports_options.bash
|
||||||
|
dest: /usr/local/bin/find_popular_ports_options
|
||||||
|
- src: find_ports_containing_option.bash
|
||||||
|
dest: /usr/local/bin/find_ports_containing_option
|
||||||
|
- src: find_packages_that_installed_kernel_modules.bash
|
||||||
|
dest: /usr/local/bin/find_packages_that_installed_kernel_modules
|
||||||
|
@ -7,9 +7,7 @@
|
|||||||
CPUTYPE?=tigerlake
|
CPUTYPE?=tigerlake
|
||||||
# CPUTYPE?=x86-64-v4
|
# CPUTYPE?=x86-64-v4
|
||||||
.endif
|
.endif
|
||||||
OPTIMIZED_CFLAGS=YES
|
|
||||||
BUILD_OPTIMIZED=YES
|
|
||||||
WITH_CPUFLAGS=YES
|
|
||||||
# Disable static for subversion because /usr/local/lib/libutf8proc.a not found despite utf8proc being installed
|
# Disable static for subversion because /usr/local/lib/libutf8proc.a not found despite utf8proc being installed
|
||||||
#
|
#
|
||||||
# Disable static for netpbm because "ld: error: undefined symbol: libdeflate_free_compressor" which is "referenced by tif_zip.o:(ZIPVSetField) in archive /usr/local/lib/libtiff.a"
|
# Disable static for netpbm because "ld: error: undefined symbol: libdeflate_free_compressor" which is "referenced by tif_zip.o:(ZIPVSetField) in archive /usr/local/lib/libtiff.a"
|
||||||
@ -22,3 +20,7 @@ WITH_CPUFLAGS=YES
|
|||||||
.if ${.CURDIR:N*/devel/subversion*} && ${.CURDIR:N*/graphics/netpbm*} && ${.CURDIR:N*/audio/libsndfile*} && ${.CURDIR:N*/www/firefox*} && ${.CURDIR:N*/shells/zsh*}
|
.if ${.CURDIR:N*/devel/subversion*} && ${.CURDIR:N*/graphics/netpbm*} && ${.CURDIR:N*/audio/libsndfile*} && ${.CURDIR:N*/www/firefox*} && ${.CURDIR:N*/shells/zsh*}
|
||||||
OPTIONS_SET+=STATIC LTO
|
OPTIONS_SET+=STATIC LTO
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
OPTIONS_SET+=OPTIMIZED_CFLAGS
|
||||||
|
# qemu uses STATIC_LINK instead of the more standard flag of STATIC
|
||||||
|
OPTIONS_SET+=STATIC_LINK
|
||||||
|
Loading…
x
Reference in New Issue
Block a user