-
Notifications
You must be signed in to change notification settings - Fork 1
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
fixing linux headers in buildlibs.sh #107
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
2df38d5
Ok
viega 082757c
...
viega 082abec
Try to keep musl-gcc as well.
viega 671acca
I can't seem to get nimble to keep around musl-gcc; it definitely doe…
viega 18decf0
Try to hold on to the spec file too
viega 89c845a
Quick fix attempt for getting the musl spec file to stay. It might no…
viega aacec0d
Revert "Try to hold on to the spec file too"
viega 0bc3a49
...
viega 4f02a66
Fix typo
viega 1f31b92
Cache linux-amd libs
viega d3c5eef
Edit the MUSL file after a con4m build.
viega 55289dd
Add debugging so I can see why the script doesn't work
viega eeca49e
Keep the MUSL libs around
viega 2e06298
Install MUSL into ~/.local/ (or under ), because it's just far easier
viega b1e69b3
Remove those .a's just in case
viega 2e04b42
...
viega 8fd75dc
...
viega 10b315f
...
viega 8e23c85
...
viega 1eb77e6
Do everything out of ~/.local by default to avoid all the gymnastics.
viega be24d2b
Cleanup the config.nims, etc
viega 7f059ac
fixing linux headers in buildlibs.sh
miki725 7bce790
fixing trailing whitespace
miki725 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
Con4m makes it easy to give users rich configurability via config | ||
files and command line flags. You just have to write a spec to get | ||
your config file format and your command line flags / parsing. | ||
your config file format and your command line flags / parsing. | ||
|
||
You can do all of your input validation either through Con4m's built | ||
in constraints, or through custom validation routines (themselves | ||
|
@@ -231,4 +231,3 @@ Con4m is open source under the Apache 2.0 license. | |
Con4m was written by John Viega ([email protected]), originally | ||
for Chalk and other to-be-named projects, because other options for | ||
flexibile configs (like HCL, or YAML DSLs) all kinda suck. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,220 @@ | ||
#!/bin/bash | ||
|
||
# ensure there is no silent failures | ||
set -eEu | ||
set -o pipefail | ||
|
||
ARCH=$(uname -m) | ||
OS=$(uname -o) | ||
|
||
if [[ ${ARCH} = "x86_64" ]] ; then | ||
NIMARCH=amd64 | ||
else | ||
NIMARCH=arm64 | ||
fi | ||
|
||
if [[ ${OS} = "Darwin" ]] ; then | ||
# Not awesome, but this is what nim calls it. | ||
OS=macosx | ||
else | ||
# We don't support anything else at the moment. | ||
OS=linux | ||
fi | ||
|
||
DEPS_DIR=${DEPS_DIR:-${HOME}/.local/c0} | ||
|
||
PKG_LIBS=${1}/lib/${OS}-${NIMARCH} | ||
MY_LIBS=${DEPS_DIR}/libs | ||
SRC_DIR=${DEPS_DIR}/src | ||
MUSL_DIR=${DEPS_DIR}/musl | ||
MUSL_GCC=${MUSL_DIR}/bin/musl-gcc | ||
|
||
mkdir -p ${MY_LIBS} | ||
cd ${DEPS_DIR} | ||
|
||
# The paste doesn't work from stdin on MacOS, so leave this as is, please. | ||
export OPENSSL_CONFIG_OPTS=$(echo " | ||
enable-ec_nistp_64_gcc_128 | ||
no-afalgeng | ||
no-apps | ||
no-bf | ||
no-camellia | ||
no-cast | ||
no-comp | ||
no-deprecated | ||
no-des | ||
no-docs | ||
no-dtls | ||
no-dtls1 | ||
no-egd | ||
no-engine | ||
no-err | ||
no-idea | ||
no-md2 | ||
no-md4 | ||
no-mdc2 | ||
no-psk | ||
no-quic | ||
no-rc2 | ||
no-rc4 | ||
no-rc5 | ||
no-seed | ||
no-shared | ||
no-srp | ||
no-ssl | ||
no-tests | ||
no-tls1 | ||
no-tls1_1 | ||
no-uplink | ||
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 | ||
|
||
echo -n $(tput setaf ${CODE})$@$(tput op) | ||
} | ||
|
||
function colorln { | ||
echo $(color $@) | ||
} | ||
|
||
function copy_from_package { | ||
for item in ${@} | ||
do | ||
if [[ ! -f ${MY_LIBS}/${item} ]] ; then | ||
if [[ ! -f ${PKG_LIBS}/${item} ]] ; then | ||
return 1 | ||
else | ||
cp ${PKG_LIBS}/${item} ${MY_LIBS} | ||
fi | ||
fi | ||
done | ||
return 0 | ||
} | ||
|
||
function get_src { | ||
mkdir -p ${SRC_DIR} | ||
cd ${SRC_DIR} | ||
|
||
if [[ ! -d ${SRC_DIR}/${1} ]] ; then | ||
echo $(color CYAN Downloading ${1} from:) ${2} | ||
git clone ${2} | ||
fi | ||
if [[ ! -d ${1} ]] ; then | ||
echo $(color RED Could not create directory: ) ${SRC_DIR}/${1} | ||
exit 1 | ||
fi | ||
cd ${1} | ||
} | ||
|
||
function ensure_musl { | ||
if [[ ${OS} = "macosx" ]] ; then | ||
return | ||
fi | ||
if [[ ! -f ${MUSL_GCC} ]] ; then | ||
get_src musl git://git.musl-libc.org/musl | ||
colorln CYAN Building musl | ||
unset CC | ||
./configure --disable-shared --prefix=${MUSL_DIR} | ||
make clean | ||
make | ||
make install | ||
mv lib/*.a ${MY_LIBS} | ||
|
||
if [[ -f ${MUSL_GCC} ]] ; then | ||
echo $(color GREEN Installed musl wrapper to:) ${MUSL_GCC} | ||
else | ||
colorln RED Installation of musl failed! | ||
exit 1 | ||
fi | ||
fi | ||
export CC=${MUSL_GCC} | ||
export CXX=${MUSL_GCC} | ||
} | ||
|
||
function install_kernel_headers { | ||
if [[ ${OS} = "macosx" ]] ; then | ||
return | ||
fi | ||
colorln CYAN Installing kernel headers needed for musl install | ||
get_src kernel-headers https://github.com/sabotage-linux/kernel-headers.git | ||
make ARCH=${ARCH} prefix= DESTDIR=${MUSL_DIR} install | ||
} | ||
|
||
function ensure_openssl { | ||
|
||
if ! copy_from_package libssl.a libcrypto.a ; then | ||
ensure_musl | ||
install_kernel_headers | ||
|
||
get_src openssl https://github.com/openssl/openssl.git | ||
colorln CYAN Building openssl | ||
if [[ ${OS} == "macosx" ]]; then | ||
./config ${OPENSSL_CONFIG_OPTS} | ||
else | ||
./config ${OPENSSL_CONFIG_OPTS} -static | ||
fi | ||
make clean | ||
make build_libs | ||
mv *.a ${MY_LIBS} | ||
if [[ -f ${MY_LIBS}/libssl.a ]] && [[ -f ${MY_LIBS}/libcrypto.a ]] ; then | ||
echo $(color GREEN Installed openssl libs to:) ${MY_LIBS} | ||
else | ||
colorln RED Installation of openssl failed! | ||
exit 1 | ||
fi | ||
fi | ||
} | ||
|
||
function ensure_pcre { | ||
if ! copy_from_package libpcre.a ; then | ||
|
||
get_src pcre https://github.com/luvit/pcre.git | ||
colorln CYAN "Building libpcre" | ||
# For some reason, build fails on arm if we try to compile w/ musl? | ||
unset CC | ||
./configure --disable-cpp --disable-shared | ||
make clean | ||
make | ||
|
||
mv .libs/libpcre.a ${MY_LIBS} | ||
if [[ -f ${MY_LIBS}/libpcre.a ]] ; then | ||
echo $(color GREEN Installed libpcre to:) ${MY_LIBS}/libpcrea. | ||
else | ||
colorln RED "Installation of libprce failed. This may be due to missing build dependencies. Please make sure autoconf, m4 and perl are installed." | ||
exit 1 | ||
fi | ||
fi | ||
} | ||
|
||
function remove_src { | ||
# Don't nuke the src if CON4M_DEV is on. | ||
if [[ -d ${SRC_DIR} ]] ; then | ||
if [[ -z ${CON4M_DEV+woo} ]] ; then | ||
colorln CYAN Removing code \(because CON4M_DEV is not set\) | ||
rm -rf ${SRC_DIR} | ||
else | ||
colorln CYAN Keeping source code \(CON4M_DEV is set\) | ||
fi | ||
fi | ||
} | ||
|
||
ensure_musl | ||
ensure_openssl | ||
ensure_pcre | ||
|
||
colorln GREEN All dependencies satisfied. | ||
remove_src |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this has the actual fix by removing prefix and updating
DESTDIR