-
Notifications
You must be signed in to change notification settings - Fork 215
Add build/pkg-install.sh. #196
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| #!/bin/sh | ||
|
|
||
| set -e | ||
|
|
||
| _IFS="$IFS"; IFS=':' | ||
| for dir in $PKG_CONFIG_PATH `pkg-config --variable pc_path pkg-config`; do | ||
| if [ -d "${dir}" -a -w "${dir}" -a -d "${dir}/../../include" ]; then | ||
| DST="$dir" | ||
| break | ||
| fi | ||
| done | ||
| IFS="$_IFS"; unset _IFS | ||
|
|
||
| if [ -z "${DST}" ]; then | ||
| echo "no suitable pkg-config directory found." | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ `basename $0` = "pkg-install.sh" ]; then | ||
| SRC=`dirname $0` | ||
| SRC=`(cd $SRC/..; [ -d .git ] && pwd)` | ||
| fi | ||
|
|
||
| export DST | ||
| cd ${TMPDIR:-/tmp} | ||
|
|
||
| trap 'rm -rf blst.$$' 0 | ||
| git clone ${SRC:-"https://github.com/supranational/blst"} blst.$$ | ||
| ( trap '[ $? -ne 0 ] && rm "${DST}/blst.pc" 2>/dev/null' 0 | ||
| cd blst.$$ | ||
| tag=`git tag --sort=v:refname | tail -1` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The git tag version is currently I had to modify that line to:
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This breaks the next line. I've pushed a fixup... |
||
| git checkout --detach ${tag} | ||
| tag=`expr substr $tag 2 8` | ||
| ./build.sh "$@" | ||
| cp libblst.a "${DST}/.." | ||
| cp bindings/blst.h* "${DST}/../../include" | ||
| cat > "${DST}/blst.pc" << blst.pc | ||
| libdir=\${pcfiledir}/.. | ||
| incdir=\${pcfiledir}/../../include | ||
| Name: blst | ||
| Version: $tag | ||
| Description: blst core library | ||
| Cflags: -I\${incdir} | ||
| Libs: -L\${libdir} -lblst | ||
| blst.pc | ||
| ) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please have a way to override invoking git via env vars?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I genuinely don't understand. What is the goal? Why specifically via environment variables? Note that git is used to figure out version...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to package blst in a downstream project (FreeBSD). Package building infrastructure usually disable any networking access during the build, so in this case I'd need a way to prevent this script from calling git.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If $SRC is assigned, it's a local directory, so that git won't use network.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is still has to be a git repository. At least RPM and FreeBSD ports do not usually use git to fetch the distribution files, so in these contexts there would be no git repo at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But they have to use something and hence they could use git. Yes, it would be unusual, but in the essence it's just a download.
Again, the suggested script uses git for unambiguous versioning while also preserving custody. It's argued that it's reasonable trade-off for the unconventional download method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are common and established ways to build software (meson, CMake, git tags and GitHub releases, etc.), which are easily connected to downstream package building infrastructures. When a project goes its own way with custom building scripts it immediately makes it much harder to be properly packaged. But that's my problem anyways, so do whatever you want.