Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(buildlibs.sh): Small changes to the buildlibs.sh script to provide macOS compatibility #110

Merged
merged 7 commits into from
Sep 7, 2023

Conversation

MyNameIsMeerkat
Copy link
Contributor

@MyNameIsMeerkat MyNameIsMeerkat commented Sep 5, 2023

macOS uses BSD sed which errors out with the attempted usage of -i for 'inplace'. The provided alternative is pretty gross but is cross-platform in terms of BSD & GNU sed. Replaced whole sed approach with just dumping a CMakelists.txt file of predefined structure.

The provision of a default argument to the ${1} variable was needed to avoid an unset parameter error on macOS, I expect the root cause here to be whatever the version of bash macOS is using and whatever vintage it is vs current bash mainline.

Older versions of macOS/OSX ship with a version of uname that doesn't not support the -o switch for collecting OS version, it instead uses -s. Fix tries uname -o first and if that fails falls back to uname -s.

@@ -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}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a huge fan of the default string I have provided here but not sure what would be better. V open to suggestions

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather blow up if the variable isn't provided, if we actually need to do something here. Generally, nobody should need to run this manually.

@MyNameIsMeerkat MyNameIsMeerkat marked this pull request as ready for review September 5, 2023 20:12
Copy link
Contributor

@viega viega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hope you don't mind me just pushing to your branch, I just changed the way you were dealing with no argument from having a default to bombing if not provided.

@@ -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}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather blow up if the variable isn't provided, if we actually need to do something here. Generally, nobody should need to run this manually.

@@ -223,7 +226,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*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assume this is some leftover stuff?

@MyNameIsMeerkat MyNameIsMeerkat added this pull request to the merge queue Sep 7, 2023
Merged via the queue into main with commit d6071ab Sep 7, 2023
@MyNameIsMeerkat MyNameIsMeerkat deleted the mynameismeerkat/buildlib_macos_fix branch September 7, 2023 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants