1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 # Copyright 2000, 2010 Oracle and/or its affiliates.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # This file is part of OpenOffice.org.
11 # OpenOffice.org is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU Lesser General Public License version 3
13 # only, as published by the Free Software Foundation.
15 # OpenOffice.org is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU Lesser General Public License version 3 for more details
19 # (a copy is included in the LICENSE file that accompanied this code).
21 # You should have received a copy of the GNU Lesser General Public License
22 # version 3 along with OpenOffice.org. If not, see
23 # <http://www.openoffice.org/license.html>
24 # for a copy of the LGPLv3 License.
26 #*************************************************************************
33 # --- Settings -----------------------------------------------------
35 .INCLUDE
: settings.mk
37 .IF
"$(DISABLE_PYTHON)"!="TRUE"
39 .INCLUDE
: pyversion.mk
41 .IF
"$(SYSTEM_PYTHON)" == "YES"
43 @echo
"An already available installation of python should exist on your system."
44 @echo
"Therefore the version provided here does not need to be built in addition."
47 # --- Files --------------------------------------------------------
49 TARFILE_NAME
=Python-
$(PYVERSION
)
50 TARFILE_MD5
=e81c2f0953aa60f8062c05a4673f2be0
52 Python-
$(PYVERSION
).patch \
53 Python-parallel-make.patch \
56 Python-2.6
.1-urllib.patch \
57 Python-2.6
.1-sysbase.patch \
58 Python-2.6
.1-nohardlink.patch \
59 Python-2.6
.1-py2422.patch \
60 Python-2.6
.1-py4768.patch
66 MYCWD
=$(shell @pwd
)/$(INPATH
)/misc
/build
68 # CLFLAGS get overwritten in Makefile.pre.in
70 CC
+:=-I
$(SYSBASE
)$/usr
$/include
71 python_LDFLAGS
+=-L
$(SYSBASE
)/usr
/lib
72 .IF
"$(COMNAME)"=="sunpro5"
73 CC
+:=$(C_RESTRICTIONFLAGS
)
74 .ENDIF
# "$(COMNAME)"=="sunpro5"
75 .ENDIF
# "$(SYSBASE)"!=""
77 .IF
"$(OS)$(CPU)"=="SOLARISU"
79 python_LDFLAGS
+=$(ARCH_FLAGS
)
86 CONFIGURE_ACTION
=$(AUGMENT_LIBRARY_PATH
) .
/configure
--prefix=/python-inst
--enable-shared CFLAGS
="$(python_CFLAGS)" LDFLAGS
="$(python_LDFLAGS)"
88 .IF
"$(OS)$(CPU)" == "SOLARISI"
89 CONFIGURE_ACTION
+= --disable-ipv6
92 .IF
"$(OS)" == "MACOSX"
93 PATCH_FILES
+=Python-2.6
.1-py8067.patch Python-2.6
.1-dylib_dynload.patch
94 # don't build dual-arch version as OOo itself is not universal binary either
95 PATCH_FILES
+=Python-2.6
.1-arch_
$(eq
,$(CPU
),I i386 ppc
).patch
97 CONFIGURE_ACTION
+=--enable-universalsdk
=$(MACOSX_SDK_PATH
) --with-universal-archs
=32-bit
--enable-framework
=/python-inst
--with-framework-name
=OOoPython
98 ALLTAR
: $(MISC
)/OOoPython.framework.zip
103 CONFIGURE_ACTION
+= --disable-ipv6
--with-threads
105 BUILD_ACTION
=$(ENV_BUILD
) $(GNUMAKE
) -j
$(EXTMAXPROCESS
) && $(GNUMAKE
) install DESTDIR
=$(MYCWD
) && chmod
-R ug
+w
$(MYCWD
)/python-inst
&& chmod g
+w Include
107 # ----------------------------------
109 # ----------------------------------
111 PATCH_FILES
=Python-
$(PYVERSION
)-mingw.patch
113 MYCWD
=$(shell cygpath
-m
$(shell @pwd
))/$(INPATH
)/misc
/build
114 python_CFLAGS
=-mno-cygwin
-mthreads
115 python_LDFLAGS
=-mno-cygwin
-mthreads
116 .IF
"$(MINGW_SHARED_GCCLIB)"=="YES"
117 python_LDFLAGS
+=-shared-libgcc
119 python_LDFLAGS
+=-shared-libgcc
-Wl
,--enable-runtime-pseudo-reloc-v2
120 CONFIGURE_ACTION
=.
/configure
--prefix=$(MYCWD
)/python-inst
--enable-shared CC
="$(CC:s/guw.exe //)" CXX
="$(CXX:s/guw.exe //)" MACHDEP
=MINGW32 LN
="cp -p" CFLAGS
="$(python_CFLAGS)" LDFLAGS
="$(python_LDFLAGS)"
121 BUILD_ACTION
=$(ENV_BUILD
) make
&& make
install
124 .IF
"$(CCNUMVER)" >= "001600000000"
125 PATCH_FILES
+=Python-
$(PYVERSION
)-vc10.patch
127 .ELIF
"$(CCNUMVER)" >= "001500000000"
129 .ELIF
"$(CCNUMVER)" >= "001400000000"
131 .ELIF
"$(CCNUMVER)" >= "001310000000"
149 # Build python executable and then runs a minimal script. Running the minimal script
150 # ensures that certain *.pyc files are generated which would otherwise be created on
151 # solver during registration in insetoo_native
152 .IF
"$(CCNUMVER)" >= "001600000000"
153 BUILD_ACTION
=MSBuild.exe pcbuild.sln
/t
:Build
/p
:Configuration
=$(CONF
) /ToolsVersion
:4.0
155 BUILD_ACTION
=$(COMPATH
)$/vcpackages
$/vcbuild.exe pcbuild.sln
"$(CONF)|$(ARCH)"
160 PYVERSIONFILE
=$(MISC
)$/pyversion.mk
162 # --- Targets ------------------------------------------------------
165 .INCLUDE
: set_ext.mk
166 .ENDIF
# DISABLE_PYTHON != TRUE
168 .IF
"$(DISABLE_PYTHON)"!="TRUE"
171 .IF
"$(L10N_framework)"==""
172 .IF
"$(GUI)" != "UNX"
174 PYCONFIG
:=$(MISC
)$/build
$/pyconfig.h
175 $(MISC
)$/build
$/$(TARFILE_NAME
)$/PC
$/pyconfig.h
: $(PACKAGE_DIR
)$/$(CONFIGURE_FLAG_FILE
)
177 $(PACKAGE_DIR
)$/$(BUILD_FLAG_FILE
) : $(PYCONFIG
)
179 $(PYCONFIG
) : $(MISC
)$/build
$/$(TARFILE_NAME
)$/PC
$/pyconfig.h
181 cat
$(MISC
)$/build
$/$(TARFILE_NAME
)$/PC
$/pyconfig.h
> $@
182 # We know that the only thing guarded with #ifdef _DEBUG in PC/pyconfig.h is
183 # the line defining Py_DEBUG.
185 # If Python is built with debugging, then the modules we build need to be built with
186 # Py_DEBUG defined too because of the Py_InitModule4 redefining magic in modsupport.h
187 sed
-e
's/^#ifdef _DEBUG$/#if 1/' <$@
>$@.new
&& mv
$@.new
$@
189 # Correspondingly, if Python is not built with debugging, it won't use the Py_InitModule4 redefining
190 # magic, so our Python modules should not be built to provide that either.
191 sed
-e
's/^#ifdef _DEBUG$/#if 0/' <$@
>$@.new
&& mv
$@.new
$@
196 ALLTAR
: $(PYVERSIONFILE
)
197 .ENDIF
# "$(L10N_framework)"==""
199 # rule to allow relocating the whole framework, removing reference to buildinstallation directory
200 $(PACKAGE_DIR
)/fixscripts
: $(PACKAGE_DIR
)$/$(PREDELIVER_FLAG_FILE
)
201 @echo remove build installdir from scripts
202 $(COMMAND_ECHO
)for file in \
203 $(MYCWD
)/python-inst
/OOoPython.framework
/Versions
/$(PYMAJOR
).
$(PYMINOR
)/bin
/2to3 \
204 $(MYCWD
)/python-inst
/OOoPython.framework
/Versions
/$(PYMAJOR
).
$(PYMINOR
)/bin
/idle
$(PYMAJOR
).
$(PYMINOR
) \
205 $(MYCWD
)/python-inst
/OOoPython.framework
/Versions
/$(PYMAJOR
).
$(PYMINOR
)/bin
/pydoc
$(PYMAJOR
).
$(PYMINOR
) \
206 $(MYCWD
)/python-inst
/OOoPython.framework
/Versions
/$(PYMAJOR
).
$(PYMINOR
)/bin
/python
$(PYMAJOR
).
$(PYMINOR
)-config \
207 $(MYCWD
)/python-inst
/OOoPython.framework
/Versions
/$(PYMAJOR
).
$(PYMINOR
)/bin
/smtpd
$(PYMAJOR
).
$(PYMINOR
).py
; do \
208 {{ rm "$$file" && awk
'\
212 bindir=$$(cd $$(dirname \"$$0\") ; pwd)\n\
214 \"$$bindir/../Resources/Python.app/Contents/MacOS/OOoPython\" - $$@ <<EOF"}} \
217 END {{print "EOF"}}' > "$$file" ; }} < "$$file" ; chmod
+x
"$$file" ; done
220 $(PACKAGE_DIR
)/fixinstallnames
: $(PACKAGE_DIR
)$/$(PREDELIVER_FLAG_FILE
)
221 @echo remove build installdir from OOoPython
222 $(COMMAND_ECHO
)install_name_tool
-change \
223 /python-inst
/OOoPython.framework
/Versions
/$(PYMAJOR
).
$(PYMINOR
)/OOoPython \
224 @executable_path
/..
/..
/..
/..
/OOoPython \
225 $(MYCWD
)/python-inst
/OOoPython.framework
/Versions
/$(PYMAJOR
).
$(PYMINOR
)/Resources
/Python.app
/Contents
/MacOS
/OOoPython
228 $(MISC
)/OOoPython.framework.zip
: $(PACKAGE_DIR
)/fixinstallnames
$(PACKAGE_DIR
)/fixscripts
231 $(COMMAND_ECHO
)cd
$(MISC
)/build
/python-inst
&& find OOoPython.framework \
232 -not
-type l
-not
-name Info.plist.in \
233 -not
-name pythonw
$(PYMAJOR
).
$(PYMINOR
) \
234 -not
-name python
$(PYMAJOR
).
$(PYMINOR
) -print0 | \
235 xargs
-0 zip
$(ZIP_VERBOSITY
) ..
/..
/$(@
:f
)
237 $(PYVERSIONFILE
) : pyversion.mk
$(PACKAGE_DIR
)$/$(PREDELIVER_FLAG_FILE
)
239 $(COMMAND_ECHO
)$(COPY
) pyversion.mk
$@
241 .ENDIF
# DISABLE_PYTHON != TRUE