Skip to content

Instantly share code, notes, and snippets.

@thorrr
Created November 22, 2016 03:00
Show Gist options
  • Save thorrr/271058eeb5f1903213938f89fcbc3a73 to your computer and use it in GitHub Desktop.
Save thorrr/271058eeb5f1903213938f89fcbc3a73 to your computer and use it in GitHub Desktop.
#!/bin/sh
filename=/usr/include/python2.7/pyconfig.h
patchfile=$(mktemp)
cat << 'EOF' > "$patchfile"
--- pyconfig.h 2016-11-20 09:38:22.434174700 -0500
+++ pyconfig-bsd-not-visible.h 2016-11-20 09:38:05.391993200 -0500
@@ -1218,7 +1218,7 @@
#define _XOPEN_SOURCE_EXTENDED 1
/* Define on FreeBSD to activate all library features */
-#define __BSD_VISIBLE 1
+#define __BSD_VISIBLE 0
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
EOF
grep "#define __BSD_VISIBLE 1" "$filename" 2>&1 > /dev/null
if [ $? == 0 ]; then
patch /usr/include/python2.7/pyconfig.h <"$patchfile"
fi
trap "{ rm \"$patchfile\"; }" EXIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment