From b73be0388b79b7147ddb2d6e978ead47e0c06d1e Mon Sep 17 00:00:00 2001 From: Rich Smith Date: Tue, 5 Sep 2023 13:45:20 -0400 Subject: [PATCH 1/6] fix(buildlibs.sh) tweak sed syntax to work with gnu & BSD sed versions for macOS compatability --- files/bin/buildlibs.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/bin/buildlibs.sh b/files/bin/buildlibs.sh index bbb7424a..624bc42f 100755 --- a/files/bin/buildlibs.sh +++ b/files/bin/buildlibs.sh @@ -223,7 +223,8 @@ function ensure_gumbo { if ! copy_from_package libgumbo.a ; then ensure_musl get_src sigil-gumbo https://github.com/Sigil-Ebook/sigil-gumbo/ - sed -i '/examples/d' CMake* + sed -i.bakconf4mbak '/examples/d' CMake* + rm *.bakconf4mbak colorln CYAN "Cooking up some gumbo" mkdir build cd build From 862968e69ff36abd43bfec0aa962f6208d35d84f Mon Sep 17 00:00:00 2001 From: Rich Smith Date: Tue, 5 Sep 2023 14:51:51 -0400 Subject: [PATCH 2/6] fix(buildlibs.sh) provide default value to construct to avoid macos undefined value error --- files/bin/buildlibs.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/files/bin/buildlibs.sh b/files/bin/buildlibs.sh index 624bc42f..f4f13f60 100755 --- a/files/bin/buildlibs.sh +++ b/files/bin/buildlibs.sh @@ -21,8 +21,7 @@ else fi DEPS_DIR=${DEPS_DIR:-${HOME}/.local/c0} - -PKG_LIBS=${1}/lib/${OS}-${NIMARCH} +PKG_LIBS=${1:-"./files/deps"}/lib/${OS}-${NIMARCH} MY_LIBS=${DEPS_DIR}/libs SRC_DIR=${DEPS_DIR}/src MUSL_DIR=${DEPS_DIR}/musl From 88c7e179d2eff34de7aed11f128715599c4ff38e Mon Sep 17 00:00:00 2001 From: Rich Smith Date: Tue, 5 Sep 2023 15:51:26 -0400 Subject: [PATCH 3/6] fix(buildlibs.sh): older versiona of macOS don't support -o switch for uname --- files/bin/buildlibs.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/files/bin/buildlibs.sh b/files/bin/buildlibs.sh index f4f13f60..7574bb4d 100755 --- a/files/bin/buildlibs.sh +++ b/files/bin/buildlibs.sh @@ -1,10 +1,14 @@ #!/bin/bash +OS=$(uname -o 2>/dev/null) +if [[ ${?} != 0 ]] ; then + # Older macOS/OSX versions of uname don't support -o + OS=$(uname -s) +fi set -eEu set -o pipefail ARCH=$(uname -m) -OS=$(uname -o) if [[ ${ARCH} = "x86_64" ]] ; then NIMARCH=amd64 From ed66e328ebc4a05abcbe4dcb0a769fc25512cac5 Mon Sep 17 00:00:00 2001 From: Rich Smith Date: Wed, 6 Sep 2023 18:49:10 -0400 Subject: [PATCH 4/6] fix(buildlibs.sh) remove usage of sed and revert to using specified CMakeList.txt --- files/bin/buildlibs.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/files/bin/buildlibs.sh b/files/bin/buildlibs.sh index 7574bb4d..21e40bad 100755 --- a/files/bin/buildlibs.sh +++ b/files/bin/buildlibs.sh @@ -226,8 +226,23 @@ function ensure_gumbo { if ! copy_from_package libgumbo.a ; then ensure_musl get_src sigil-gumbo https://github.com/Sigil-Ebook/sigil-gumbo/ - sed -i.bakconf4mbak '/examples/d' CMake* - rm *.bakconf4mbak + colorln CYAN "Watching our waistline, selecting only required gumbo ingredients...." + cat > CMakelists.txt < Date: Wed, 6 Sep 2023 18:52:50 -0400 Subject: [PATCH 5/6] =?UTF-8?q?fix(buildlibs.sh)=20end=20of=20line=20white?= =?UTF-8?q?space=20removal=20=F0=9F=A4=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/bin/buildlibs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/bin/buildlibs.sh b/files/bin/buildlibs.sh index 21e40bad..48c95ad3 100755 --- a/files/bin/buildlibs.sh +++ b/files/bin/buildlibs.sh @@ -228,9 +228,9 @@ function ensure_gumbo { get_src sigil-gumbo https://github.com/Sigil-Ebook/sigil-gumbo/ colorln CYAN "Watching our waistline, selecting only required gumbo ingredients...." cat > CMakelists.txt < Date: Wed, 6 Sep 2023 21:35:14 -0400 Subject: [PATCH 6/6] Changed the way that a lack of an argument is handled. --- files/bin/buildlibs.sh | 64 ++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/files/bin/buildlibs.sh b/files/bin/buildlibs.sh index afd9dcd4..d8ef20d5 100755 --- a/files/bin/buildlibs.sh +++ b/files/bin/buildlibs.sh @@ -1,15 +1,40 @@ #!/bin/bash -OS=$(uname -o 2>/dev/null) -if [[ ${?} != 0 ]] ; then - # Older macOS/OSX versions of uname don't support -o - OS=$(uname -s) -fi +function color { + case $1 in + black) CODE=0 ;; + red) CODE=1 ;; RED) CODE=9 ;; + green) CODE=2 ;; GREEN) CODE=10 ;; + yellow) CODE=3 ;; YELLOW) CODE=11 ;; + blue) CODE=4 ;; BLUE) CODE=12 ;; + magenta) CODE=5 ;; MAGENTA) CODE=13 ;; + cyan) CODE=6 ;; CYAN) CODE=14 ;; + white) CODE=7 ;; WHITE) CODE=15 ;; + grey) CODE=8 ;; *) CODE=$1 ;; + esac + shift + + export TERM=${TERM:-vt100} + echo -n $(tput -T ${TERM} setaf ${CODE})$@$(tput -T ${TERM} op) +} + +function colorln { + echo $(color $@) +} + +if [[ ${#} -eq 0 ]] ; then + colorln RED Script requires an argument pointing to the deps directory + exit 1 +fi set -eEu set -o pipefail ARCH=$(uname -m) - +OS=$(uname -o 2>/dev/null) +if [[ ${?} != 0 ]] ; then + # Older macOS/OSX versions of uname don't support -o + OS=$(uname -s) +fi if [[ ${OS} = "Darwin" ]] ; then # Not awesome, but this is what nim calls it. @@ -36,7 +61,8 @@ else fi DEPS_DIR=${DEPS_DIR:-${HOME}/.local/c0} -PKG_LIBS=${1:-"./files/deps"}/lib/${OS}-${NIMARCH} + +PKG_LIBS=${1}/lib/${OS}-${NIMARCH} MY_LIBS=${DEPS_DIR}/libs SRC_DIR=${DEPS_DIR}/src MUSL_DIR=${DEPS_DIR}/musl @@ -82,28 +108,6 @@ no-weak-ssl-ciphers no-zlib " | tr '\n' ' ') -function color { - case $1 in - black) CODE=0 ;; - red) CODE=1 ;; RED) CODE=9 ;; - green) CODE=2 ;; GREEN) CODE=10 ;; - yellow) CODE=3 ;; YELLOW) CODE=11 ;; - blue) CODE=4 ;; BLUE) CODE=12 ;; - magenta) CODE=5 ;; MAGENTA) CODE=13 ;; - cyan) CODE=6 ;; CYAN) CODE=14 ;; - white) CODE=7 ;; WHITE) CODE=15 ;; - grey) CODE=8 ;; *) CODE=$1 ;; - esac - shift - - export TERM=${TERM:-vt100} - echo -n $(tput -T ${TERM} setaf ${CODE})$@$(tput -T ${TERM} op) -} - -function colorln { - echo $(color $@) -} - function copy_from_package { for item in ${@} do @@ -237,7 +241,7 @@ function ensure_gumbo { if ! copy_from_package libgumbo.a ; then ensure_musl get_src sigil-gumbo https://github.com/Sigil-Ebook/sigil-gumbo/ - colorln CYAN "Watching our waistline, selecting only required gumbo ingredients...." + colorln CYAN "Watching our waistline, selecting only required gumbo ingredients..." cat > CMakelists.txt <