Skip to content

Commit

Permalink
allow Python to build for OSX 10.9 on OSX 10.12
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhendricks committed Mar 24, 2017
1 parent c5f2ec6 commit 0b1cfc2
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 12 deletions.
13 changes: 9 additions & 4 deletions docs/Building_A_Relocatable_Python_Framework_on_MacOSX.txt
Expand Up @@ -37,13 +37,19 @@ export MYDEST=/Users/${USER}/devtools/Frameworks
# now build Python 3.5.2 as a framework
# Need to patch Python-3.5.2 to allow it to build Mac OS X 10.9 compliant
# and for it to find and use the latest Tk and Tcl frameworks
# Look in Sigil's "docs" to get the required patch "python_3.5_fixes.patch"
# Look in Sigil's "docs" to get the required patch "python_3.5_fixes3.patch"

tar -zxvf Python-3.5.2.tgz
cd Python-3.5.2
patch -p0 < python_3.5_fixes.patch
patch -p0 < python_3.5_fixes3.patch


LDFLAGS="-Wl,-macosx_version_min,10.9" CFLAGS="-mmacosx-version-min=10.9 -Werror=partial-availability" ./configure --prefix=${MYDEST} --enable-framework=${MYDEST} --with-ensurepip

or

./configure --prefix=${MYDEST} --enable-framework=${MYDEST} --with-ensurepip

./configure --prefix=${MYDEST} --enable-framework=${MYDEST} --with-ensurepip MACOSX_DEPLOYMENT_TARGET=10.9
make
sudo make frameworkinstall

Expand Down Expand Up @@ -153,4 +159,3 @@ sudo make install

# Once complete you will have properly built a Python 3.5 interpreter to be embedded inside
# of Sigil

89 changes: 81 additions & 8 deletions docs/python_3.5_fixes.patch → docs/python_3.5_fixes3.patch 100644 → 100755
@@ -1,14 +1,15 @@
--- configure.orig 2016-06-25 17:38:39.000000000 -0400
+++ configure 2017-01-16 19:33:02.000000000 -0500
--- configure.orig 2017-03-23 09:32:23.000000000 -0400
+++ configure 2017-03-23 09:40:25.000000000 -0400
@@ -11149,26 +11149,26 @@

# checks for library functions
for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
- clock confstr ctermid dup3 execv faccessat fchmod fchmodat fchown fchownat \
- fexecve fdopendir fork fpathconf fstatat ftime ftruncate futimesat \
- futimens futimes gai_strerror getentropy \
+ clock confstr ctermid dup3 execv fchmod fchown \
+ fexecve fork fpathconf ftime ftruncate futimesat \
futimens futimes gai_strerror getentropy \
+ futimens futimes gai_strerror \
getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \
getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
if_nameindex \
Expand Down Expand Up @@ -43,7 +44,7 @@
+then
+ # checks for library functions
+ for ac_func in faccessat fchmodat fchownat \
+ fdopendir fstatat linkat mkdirat openat readlinkat renameat \
+ fdopendir fstatat getentropy linkat mkdirat openat readlinkat renameat \
+ symlinkat unlinkat
+ do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
Expand All @@ -59,17 +60,49 @@

ac_fn_c_check_decl "$LINENO" "dirfd" "ac_cv_have_decl_dirfd" "#include <sys/types.h>
#include <dirent.h>
--- configure.ac.orig 2016-06-25 17:38:39.000000000 -0400
+++ configure.ac 2017-01-16 19:33:02.000000000 -0500
@@ -12383,7 +12400,8 @@
fi
done

-
+if test "`uname -s`" != "Darwin"
+then
for ac_func in clock_gettime
do :
ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime"
@@ -12444,8 +12462,10 @@

fi
done
+fi

-
+if test "`uname -s`" != "Darwin"
+then
for ac_func in clock_getres
do :
ac_fn_c_check_func "$LINENO" "clock_getres" "ac_cv_func_clock_getres"
@@ -12502,7 +12522,7 @@

fi
done
-
+fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for major" >&5
$as_echo_n "checking for major... " >&6; }
--- configure.ac.orig 2017-03-23 09:32:33.000000000 -0400
+++ configure.ac 2017-03-23 09:36:22.000000000 -0400
@@ -3270,28 +3270,36 @@

# checks for library functions
AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
- clock confstr ctermid dup3 execv faccessat fchmod fchmodat fchown fchownat \
- fexecve fdopendir fork fpathconf fstatat ftime ftruncate futimesat \
- futimens futimes gai_strerror getentropy \
+ clock confstr ctermid dup3 execv fchmod fchown \
+ fexecve fork fpathconf ftime ftruncate futimesat \
futimens futimes gai_strerror getentropy \
+ futimens futimes gai_strerror \
getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \
getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
if_nameindex \
Expand Down Expand Up @@ -99,13 +132,53 @@
+then
+ # checks for library functions
+ AC_CHECK_FUNCS(faccessat fchmodat fchownat \
+ fdopendir fstatat linkat mkdirat openat readlinkat renameat \
+ fdopendir fstatat getentropy linkat mkdirat openat readlinkat renameat \
+ symlinkat unlinkat)
+fi
+
AC_CHECK_DECL(dirfd,
AC_DEFINE(HAVE_DIRFD, 1,
Define if you have the 'dirfd' function or macro.), ,
@@ -3588,20 +3596,26 @@
])
)

-AC_CHECK_FUNCS(clock_gettime, [], [
- AC_CHECK_LIB(rt, clock_gettime, [
- LIBS="$LIBS -lrt"
- AC_DEFINE(HAVE_CLOCK_GETTIME, 1)
- AC_DEFINE(TIMEMODULE_LIB, [rt],
- [Library needed by timemodule.c: librt may be needed for clock_gettime()])
- ])
-])
+if test "`uname -s`" != "Darwin"
+then
+ AC_CHECK_FUNCS(clock_gettime, [], [
+ AC_CHECK_LIB(rt, clock_gettime, [
+ LIBS="$LIBS -lrt"
+ AC_DEFINE(HAVE_CLOCK_GETTIME, 1)
+ AC_DEFINE(TIMEMODULE_LIB, [rt],
+ [Library needed by timemodule.c: librt may be needed for clock_gettime()])
+ ])
+ ])
+fi

-AC_CHECK_FUNCS(clock_getres, [], [
- AC_CHECK_LIB(rt, clock_getres, [
- AC_DEFINE(HAVE_CLOCK_GETRES, 1)
- ])
-])
+if test "`uname -s`" != "Darwin"
+then
+ AC_CHECK_FUNCS(clock_getres, [], [
+ AC_CHECK_LIB(rt, clock_getres, [
+ AC_DEFINE(HAVE_CLOCK_GETRES, 1)
+ ])
+ ])
+fi

AC_MSG_CHECKING(for major, minor, and makedev)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
--- setup.py.orig 2017-01-16 19:30:36.000000000 -0500
+++ setup.py 2017-01-16 19:32:23.000000000 -0500
@@ -1731,7 +1731,7 @@
Expand Down

0 comments on commit 0b1cfc2

Please sign in to comment.