Skip to content

Commit

Permalink
gnutls compile success p11-kit added as well
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchcapper committed Dec 18, 2024
1 parent 8590a8b commit 77013a3
Show file tree
Hide file tree
Showing 9 changed files with 610 additions and 27 deletions.
3 changes: 2 additions & 1 deletion .github/packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ coreutils
diffutils
findutils
gawk
gnutls: libtasn1
gnutls: libtasn1 p11-kit zlib
grep: pcre2
gzip
highlight
Expand All @@ -16,6 +16,7 @@ openssl
patch
pcre2
pdcurses
p11-kit: libtasn1
sed
symlinks
tar
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tool_gnutls_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ jobs:
ToolName: gnutls
RequiredDeps: |
libtasn1
p11-kit
zlib
15 changes: 15 additions & 0 deletions .github/workflows/tool_p11-kit_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: p11-kit Tool Build
on:
push:
branches-ignore:
- trash
schedule:
- cron: '30 5 * * *'

jobs:
build:
uses: ./.github/workflows/tool_build.yml
with:
ToolName: p11-kit
RequiredDeps: |
libtasn1
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ The link to the changes in each row will show the source changes. For build time
| [zlib](repo_notes/zlib_README.md) | [![zlib Build](https://github.com/mitchcapper/WIN64LinuxBuild/actions/workflows/tool_zlib_build.yml/badge.svg)](https://github.com/mitchcapper/WIN64LinuxBuild/actions/workflows/tool_zlib_build.yml) |
| [zstd](repo_notes/zstd_README.md) | [![zstd Build](https://github.com/mitchcapper/WIN64LinuxBuild/actions/workflows/tool_zstd_build.yml/badge.svg)](https://github.com/mitchcapper/WIN64LinuxBuild/actions/workflows/tool_zstd_build.yml) |
| [gnutls](repo_notes/gnutls_README.md) | [![gnutls Build](https://github.com/mitchcapper/WIN64LinuxBuild/actions/workflows/tool_gnutls_build.yml/badge.svg)](https://github.com/mitchcapper/WIN64LinuxBuild/actions/workflows/tool_gnutls_build.yml) |
| [p11-kit](repo_notes/gnutls_README.md) | [![p11-kit Build](https://github.com/mitchcapper/WIN64LinuxBuild/actions/workflows/tool_p11-kit_build.yml/badge.svg)](https://github.com/mitchcapper/WIN64LinuxBuild/actions/workflows/tool_p11-kit_build.yml) |
| [libtasn1](repo_notes/gnutls_README.md) | [![libtasn1 Build](https://github.com/mitchcapper/WIN64LinuxBuild/actions/workflows/tool_libtasn1_build.yml/badge.svg)](https://github.com/mitchcapper/WIN64LinuxBuild/actions/workflows/tool_libtasn1_build.yml) |
| WIP: [bash](repo_notes/bash_README.md) | [![bash Build](https://github.com/mitchcapper/WIN64LinuxBuild/actions/workflows/tool_bash_build.yml/badge.svg)](https://github.com/mitchcapper/WIN64LinuxBuild/actions/workflows/tool_bash_build.yml) |

# What is it?
Expand Down
5 changes: 3 additions & 2 deletions build/f_gnutls_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ set -e

BLD_CONFIG_BUILD_NAME="gnutls"
BLD_CONFIG_GNU_LIBS_ADDL=( "dirent" "getopt-gnu" "opendir" "closedir" "readdir" )
BLD_CONFIG_CONFIG_CMD_ADDL=( "--with-included-unistring" "--without-p11-kit" )
BLD_CONFIG_CONFIG_CMD_ADDL=( "--with-included-unistring" )
BLD_CONFIG_VCPKG_DEPS=( "gmp" "nettle" "brotli" "zstd" )
BLD_CONFIG_PKG_CONFIG_MANUAL_ADD=( "gmp" )
BLD_CONFIG_BUILD_ADDL_CFLAGS=( "-I../gl/" )
BLD_CONFIG_BUILD_ADDL_CFLAGS_STATIC=("-DASN1_STATIC")
BLD_CONFIG_OUR_LIB_DEPS=("libtasn1")
BLD_CONFIG_OUR_LIB_DEPS=("libtasn1" "p11-kit" "zlib")
BLD_CONFIG_OUR_LIB_BINS_PATH=("libtasn1")

# BLD_CONFIG_BUILD_FOLDER_NAME="myapp2"; #if you want it compiling in a diff folder
Expand All @@ -28,6 +28,7 @@ fi

if [[ -z $SKIP_STEP || $SKIP_STEP == "our_patch" ]]; then
apply_our_repo_patch; # Applies from patches folder repo_BUILD_NAME.patch to the sources
sed -i -E 's/p11tool_options;/p11tool_options ;\n#undef write/' cligen/fixtures/output/p11tool-args.c
fi

if [[ $BLD_CONFIG_GNU_LIBS_USED -eq "1" ]]; then
Expand Down
91 changes: 91 additions & 0 deletions build/f_p11-kit_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/bin/bash
set -e
. "${WLB_SCRIPT_FOLDER:-$(dirname "$(readlink -f "$BASH_SOURCE")")}/helpers.sh"

BLD_CONFIG_BUILD_NAME="p11-kit"
BLD_CONFIG_OUR_LIB_DEPS=("libtasn1")
BLD_CONFIG_OUR_LIB_BINS_PATH=("libtasn1")
BLD_CONFIG_CONFIG_CMD_ADDL=( "--without-systemd" "--without-trust-paths" "--enable-debug=no" "--without-libffi" ) #for debug wil loverride with addl_debug
BLD_CONFIG_CONFIG_CMD_ADDL_DEBUG=( "--enable-debug=yes" )
BLD_CONFIG_BUILD_ADDL_CFLAGS_STATIC=("-DASN1_STATIC") #doesnt get used as we force static off for now
BLD_CONFIG_GNU_LIBS_ADD_TO_REPO=1
BLD_CONFIG_GNU_LIBS_ADDL=( "ssize_t" "getopt-gnu" )


#BLD_CONFIG_VCPKG_DEPS=( "libffi" )

# BLD_CONFIG_BUILD_FOLDER_NAME="myapp2"; #if you want it compiling in a diff folder
# BLD_CONFIG_BUILD_DEBUG=1

if [[ $BLD_CONFIG_PREFER_STATIC_LINKING -eq 1 ]]; then
BLD_CONFIG_BUILD_ADDL_CFLAGS=( "${BLD_CONFIG_BUILD_ADDL_CFLAGS_STATIC[@]}" ) #need this to still prevent static
BLD_CONFIG_PREFER_STATIC_LINKING=0 #they manually prevent static linking due to having to call their init??
fi



function ourmain() {
startcommon;

if test 5 -gt 100; then
echo "Just move the fi down as you want to skip steps, or pass the step to skip to (per below) as the first arg"
fi
if [[ -z $SKIP_STEP || $SKIP_STEP == "checkout" ]]; then
git_clone_and_add_ignore https://github.com/p11-glue/p11-kit .
#sed -i -E 's#build/##' configure.ac part of our patch now
#sed -i -E 's#NEED_READPASSPHRASE#!OS_WIN32#' common/Makefile.am #macro only defined is os=unix
fi

if [[ -z $SKIP_STEP || $SKIP_STEP == "our_patch" ]]; then
if [[ $BLD_CONFIG_GNU_LIBS_ADD_TO_REPO -eq "1" ]]; then
git restore --staged gnulib .gitmodules #we need to unstage them from our clone
fi
apply_our_repo_patch; # Applies from patches folder repo_BUILD_NAME.patch to the sources
cp gnulib/build-aux/bootstrap .
cp gnulib/build-aux/bootstrap.conf .
mkdir -p m4
cp build/m4/ld-version-script.m4 m4/
echo "gnulib_tool_option_extras=\" --without-tests --symlink --m4-base=m4 --lib=libp11kit --source-base=lib --cache-modules\"" >> bootstrap.conf
git_staging_add bootstrap bootstrap.conf
if [[ $BLD_CONFIG_GNU_LIBS_ADD_TO_REPO -eq "1" ]]; then
git_staging_add .gitmodules gnulib
fi
fi

if [[ $BLD_CONFIG_GNU_LIBS_USED -eq "1" ]]; then
if [[ -z $SKIP_STEP || $SKIP_STEP == "gnulib" ]]; then
gnulib_switch_to_master_and_patch;
fi
cd $BLD_CONFIG_SRC_FOLDER
if [[ -z $SKIP_STEP || $SKIP_STEP == "bootstrap" ]]; then
gnulib_add_addl_modules_and_bootstrap;
autoreconf --symlink --verbose --install --force #needed to get libtool
gnulib_ensure_buildaux_scripts_copied --forced
libtool_fixes

fi
fi
if [[ -z $SKIP_STEP || $SKIP_STEP == "autoconf" ]]; then #not empty allowed as if we bootstrapped above we dont need to run nautoconf
gnulib_ensure_buildaux_scripts_copied
autoreconf --symlink --verbose --install
libtool_fixes
autoreconf --verbose #update for libtool fixes
SKIP_STEP=""
fi

if [[ -z $SKIP_STEP || $SKIP_STEP == "vcpkg" ]]; then
vcpkg_install_package
fi
cd $BLD_CONFIG_SRC_FOLDER
if [[ -z $SKIP_STEP || $SKIP_STEP == "configure" ]]; then
configure_apply_fixes_and_run;
else
setup_build_env;
fi

run_make
make_install

finalcommon;
}
ourmain;
53 changes: 29 additions & 24 deletions patches/patches_GNULIB_BUILD_AUX_HANDLE_DOT_A_LIBS.patch
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
diff --git a/build-aux/ar-lib b/build-aux/ar-lib
index 1521987496..edcc491b70 100644
index 1521987496..855ab90a27 100644
--- a/build-aux/ar-lib
+++ b/build-aux/ar-lib
@@ -1,6 +1,11 @@
@@ -1,6 +1,10 @@
#! /bin/sh
# Wrapper for Microsoft lib.exe
+set -eo pipefail

+# Wrapper for compilers which do not understand '-c -o'.
+if [[ $GNU_BUILD_WRAPPER_DEBUG -eq 1 || -v COLOR_MAJOR ]]; then #if COLOR_MAJOR is set we want to include the wrapper so we can unset it otherwise would screw cmd output
+ . "$(dirname "$(readlink -f "$0")")/wrapper_helper.sh" "$@"
+fi
me=ar-lib
scriptversion=2024-06-19.01; # UTC

@@ -29,6 +34,14 @@ scriptversion=2024-06-19.01; # UTC
@@ -29,6 +33,14 @@ scriptversion=2024-06-19.01; # UTC
# bugs to <[email protected]> or send patches to
# <[email protected]>.

Expand All @@ -29,7 +28,7 @@ index 1521987496..edcc491b70 100644

# func_error message
func_error ()
@@ -49,6 +62,10 @@ func_file_conv ()
@@ -49,6 +61,10 @@ func_file_conv ()
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
Expand All @@ -40,24 +39,24 @@ index 1521987496..edcc491b70 100644
case `uname -s` in
MINGW*)
file_conv=mingw
@@ -60,6 +77,7 @@ func_file_conv ()
@@ -60,6 +76,7 @@ func_file_conv ()
file_conv=wine
;;
esac
+ fi
fi
case $file_conv in
mingw)
@@ -92,7 +110,7 @@ func_at_file ()
@@ -92,7 +109,7 @@ func_at_file ()

for member
do
- $AR -NOLOGO $operation:"$member" "$archive" || exit $?
+ func_ar_run $operation:"$member" "$archive"
+ func_ar_run $operation:"${COLOR_MINOR2}$member${COLOR_NONE}" "$archive"
done
}

@@ -199,7 +217,7 @@ esac
@@ -199,7 +216,7 @@ esac

if test -n "$delete"; then
if test ! -f "$orig_archive"; then
Expand All @@ -66,7 +65,7 @@ index 1521987496..edcc491b70 100644
fi
for member
do
@@ -209,14 +227,14 @@ if test -n "$delete"; then
@@ -209,14 +226,14 @@ if test -n "$delete"; then
;;
*)
func_file_conv "$1"
Expand All @@ -83,7 +82,7 @@ index 1521987496..edcc491b70 100644
fi
if test $# -gt 0; then
for member
@@ -227,15 +245,15 @@ elif test -n "$extract"; then
@@ -227,15 +244,15 @@ elif test -n "$extract"; then
;;
*)
func_file_conv "$1"
Expand All @@ -98,11 +97,11 @@ index 1521987496..edcc491b70 100644
| while read member
do
- $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
+ func_ar_run -EXTRACT:"$member" "$archive"
+ func_ar_run -EXTRACT:${COLOR_MINOR2}"$member"${COLOR_NONE} "$archive"
done
fi

@@ -266,14 +284,14 @@ elif test -n "$quick$replace"; then
@@ -266,14 +283,14 @@ elif test -n "$quick$replace"; then
done

if test -n "$orig_archive"; then
Expand All @@ -122,7 +121,7 @@ index 1521987496..edcc491b70 100644
+ func_ar_run -LIST ${COLOR_MAJOR}"$archive"${COLOR_NONE}
fi
diff --git a/build-aux/compile b/build-aux/compile
index c3e8760e96..55eb76649e 100644
index c3e8760e96..d0df0ab4ff 100644
--- a/build-aux/compile
+++ b/build-aux/compile
@@ -1,5 +1,10 @@
Expand Down Expand Up @@ -353,7 +352,7 @@ index c3e8760e96..55eb76649e 100644
shift
;;
*)
@@ -225,8 +316,29 @@ func_cl_wrapper ()
@@ -225,8 +316,31 @@ func_cl_wrapper ()
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
Expand All @@ -368,6 +367,8 @@ index c3e8760e96..55eb76649e 100644
+ ;;
+ \/*) #strip slash commands
+ ;;
+ -D*) #any defines
+ ;;
+ *)
+ FINAL_ARR+=($VAL)
+ ;;
Expand All @@ -387,14 +388,14 @@ index c3e8760e96..55eb76649e 100644
eat=
diff --git a/build-aux/ld-link b/build-aux/ld-link
new file mode 100644
index 0000000000..3b57d4e63b
index 0000000000..a8bc17a1a8
--- /dev/null
+++ b/build-aux/ld-link
@@ -0,0 +1,45 @@
@@ -0,0 +1,44 @@
+#!/bin/bash
+set -eo pipefail
+
+# Wrapper for compilers which do not understand '-c -o'.
+#wrapper around windows 'ld' aka link.exe. Primarily just colorization, path conversion, and making sure the MSVC link.exe is called NOT *nix link.
+if [[ $GNU_BUILD_WRAPPER_DEBUG -eq 1 || -v COLOR_MAJOR ]]; then #if COLOR_MAJOR is set we want to include the wrapper so we can unset it otherwise would screw cmd output
+ . "$(dirname "$(readlink -f "$0")")/wrapper_helper.sh" "$@"
+fi
Expand All @@ -407,7 +408,7 @@ index 0000000000..3b57d4e63b
+ echo $WPATH
+}
+
+# with the other wrappers you can use cl or lib as they genreally wont collide with msys but link.exe does
+# with the other wrappers you can use cl or lib as they generally wont collide with msys but link.exe does
+if [[ ! -v MS_LINK ]]; then
+ MS_LINK=`cygpath.exe -m "$VCToolsInstallDir"`
+ MS_LINK="${LINK_PATH}bin/HostX64/x64/link.exe"
Expand All @@ -430,25 +431,29 @@ index 0000000000..3b57d4e63b
+ set -- "$@" "$file"
+ shift
+done
+echo "HI MSLINK IS: $MS_LINK"
+if [[ $GNU_BUILD_WRAPPER_DEBUG -eq 1 ]]; then
+ wrapper_exec "$MS_LINK" -NOLOGO "$@"
+else
+ exec "$MS_LINK" -NOLOGO "$@"
+fi
diff --git a/build-aux/wrapper_helper.sh b/build-aux/wrapper_helper.sh
new file mode 100644
index 0000000000..4ff5b73c53
index 0000000000..7f3bc6c350
--- /dev/null
+++ b/build-aux/wrapper_helper.sh
@@ -0,0 +1,57 @@
@@ -0,0 +1,62 @@
+#!/bin/bash
+set -eo pipefail
+shopt -s inherit_errexit
+
+function clear_colors {
+ unset COLOR_MINOR COLOR_MINOR2 COLOR_MAJOR COLOR_NONE
+}
+function safer_color_echo {
+ local STR="${@//\\/\\\\}"
+ #prevent escape sequences other than \e[ so we dont get accidental escapes
+ echo -e "${STR//\\\\e[/\\e[}" 1>&2
+}
+
+CALLER_NAME=`basename ${0^^}`
+if [[ $GNU_BUILD_WRAPPER_DEBUG -eq 1 ]]; then
Expand All @@ -460,7 +465,7 @@ index 0000000000..4ff5b73c53
+ else
+ clear_colors;
+ fi
+ echo -e ${COLOR_MINOR}GNU ${CALLER_NAME} INPUT${COLOR_NONE}: "$@" 1>&2
+ safer_color_echo "${COLOR_MINOR}GNU ${CALLER_NAME} INPUT${COLOR_NONE}: $@"
+else
+ clear_colors;
+fi
Expand All @@ -483,7 +488,7 @@ index 0000000000..4ff5b73c53
+ echo -e "${@//'\e'\[*([0-9;])m/}" >> "$GNU_BUILD_CMD_FILE"
+ fi
+ if [[ $GNU_BUILD_WRAPPER_DEBUG -eq 1 ]]; then
+ echo -e "${COLOR_MINOR}GNU ${CALLER_NAME} OUTPUT${COLOR_NONE}: " "$@" $STD_DECLARE $linker_opts 1>&2
+ safer_color_echo "${COLOR_MINOR}GNU ${CALLER_NAME} OUTPUT${COLOR_NONE}: $@"
+ fi
+ declare -a WLB_RUN_CMD=("$@")
+
Expand Down
Loading

0 comments on commit 77013a3

Please sign in to comment.