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 \
61 Python-2.6
.1-svn-1.7.patch
67 MYCWD
=$(shell @pwd
)/$(INPATH
)/misc
/build
69 .IF
"$(SYSTEM_OPENSSL)" != "YES"
70 #we want to be sure we use our internal openssl if
72 CC
+:=-I
$(SOLARINCDIR
)$/external
73 python_LDFLAGS
+=-L
$(SOLARLIBDIR
)
76 # CLFLAGS get overwritten in Makefile.pre.in
78 CC
+:=-I
$(SYSBASE
)$/usr
$/include
79 python_LDFLAGS
+=-L
$(SYSBASE
)/usr
/lib
80 .IF
"$(COMNAME)"=="sunpro5"
81 CC
+:=$(C_RESTRICTIONFLAGS
)
82 .ENDIF
# "$(COMNAME)"=="sunpro5"
83 .ENDIF
# "$(SYSBASE)"!=""
85 .IF
"$(OS)$(CPU)"=="SOLARISU"
87 python_LDFLAGS
+=$(ARCH_FLAGS
)
94 .IF
"$(OS)" == "MACOSX"
95 my_prefix
= @__________________________________________________
$(EXTRPATH
)
97 my_prefix
= python-inst
100 CONFIGURE_ACTION
=$(AUGMENT_LIBRARY_PATH
) .
/configure
--prefix=/$(my_prefix
) --enable-shared CFLAGS
="$(python_CFLAGS)" LDFLAGS
="$(python_LDFLAGS)"
102 .IF
"$(OS)$(CPUNAME)" == "SOLARISINTEL"
103 CONFIGURE_ACTION
+= --disable-ipv6
106 .IF
"$(OS)" == "MACOSX"
107 PATCH_FILES
+=Python-2.6
.1-py8067.patch
108 # don't build dual-arch version as OOo itself is not universal binary either
109 PATCH_FILES
+=Python-2.6
.1-arch_
$(eq
,$(CPU
),I i386 ppc
).patch
111 CONFIGURE_ACTION
+=--enable-universalsdk
=$(MACOSX_SDK_PATH
) --with-universal-archs
=32-bit
--enable-framework
=/$(my_prefix
) --with-framework-name
=OOoPython
112 ALLTAR
: $(MISC
)/OOoPython.framework.zip
117 CONFIGURE_ACTION
+= --disable-ipv6
--with-threads
119 BUILD_ACTION
=$(ENV_BUILD
) $(GNUMAKE
) -j
$(EXTMAXPROCESS
) && $(GNUMAKE
) install DESTDIR
=$(MYCWD
) && chmod
-R ug
+w
$(MYCWD
)/$(my_prefix
) && chmod g
+w Include
121 # ----------------------------------
123 # ----------------------------------
125 PATCH_FILES
=Python-
$(PYVERSION
)-mingw.patch
127 MYCWD
=$(shell cygpath
-m
$(shell @pwd
))/$(INPATH
)/misc
/build
128 python_CFLAGS
=-mno-cygwin
-mthreads
129 python_LDFLAGS
=-mno-cygwin
-mthreads
130 .IF
"$(MINGW_SHARED_GCCLIB)"=="YES"
131 python_LDFLAGS
+=-shared-libgcc
133 python_LDFLAGS
+=-shared-libgcc
-Wl
,--enable-runtime-pseudo-reloc-v2
134 CONFIGURE_ACTION
=.
/configure
--prefix=$(MYCWD
)/$(my_prefix
) --enable-shared CC
="$(CC:s/guw.exe //)" CXX
="$(CXX:s/guw.exe //)" MACHDEP
=MINGW32 LN
="cp -p" CFLAGS
="$(python_CFLAGS)" LDFLAGS
="$(python_LDFLAGS)"
135 BUILD_ACTION
=$(ENV_BUILD
) make
&& make
install
138 .IF
"$(CCNUMVER)" >= "001600000000"
139 PATCH_FILES
+=Python-
$(PYVERSION
)-vc10.patch
141 .ELIF
"$(CCNUMVER)" >= "001500000000"
143 .ELIF
"$(CCNUMVER)" >= "001400000000"
145 .ELIF
"$(CCNUMVER)" >= "001310000000"
151 .IF
"$(CPUNAME)" == "INTEL"
163 # Build python executable and then runs a minimal script. Running the minimal script
164 # ensures that certain *.pyc files are generated which would otherwise be created on
165 # solver during registration in insetoo_native
166 .IF
"$(CCNUMVER)" >= "001600000000"
167 BUILD_ACTION
=MSBuild.exe pcbuild.sln
/t
:Build
/p
:Configuration
=$(CONF
) /ToolsVersion
:4.0
169 BUILD_ACTION
=$(COMPATH
)$/vcpackages
$/vcbuild.exe pcbuild.sln
"$(CONF)|$(ARCH)"
174 PYVERSIONFILE
=$(MISC
)$/pyversion.mk
175 PYVERSIONGFILE
=$(MISC
)$/pyversion.Makefile
177 # --- Targets ------------------------------------------------------
180 .INCLUDE
: set_ext.mk
181 .ENDIF
# DISABLE_PYTHON != TRUE
183 .IF
"$(DISABLE_PYTHON)"!="TRUE"
186 .IF
"$(L10N_framework)"==""
187 .IF
"$(GUI)" != "UNX"
189 PYCONFIG
:=$(MISC
)$/build
$/pyconfig.h
190 $(MISC
)$/build
$/$(TARFILE_NAME
)$/PC
$/pyconfig.h
: $(PACKAGE_DIR
)$/$(CONFIGURE_FLAG_FILE
)
192 $(PACKAGE_DIR
)$/$(BUILD_FLAG_FILE
) : $(PYCONFIG
)
194 $(PYCONFIG
) : $(MISC
)$/build
$/$(TARFILE_NAME
)$/PC
$/pyconfig.h
196 cat
$(MISC
)$/build
$/$(TARFILE_NAME
)$/PC
$/pyconfig.h
> $@
197 # We know that the only thing guarded with #ifdef _DEBUG in PC/pyconfig.h is
198 # the line defining Py_DEBUG.
200 # If Python is built with debugging, then the modules we build need to be built with
201 # Py_DEBUG defined too because of the Py_InitModule4 redefining magic in modsupport.h
202 sed
-e
's/^#ifdef _DEBUG$/#if 1/' <$@
>$@.new
&& mv
$@.new
$@
204 # Correspondingly, if Python is not built with debugging, it won't use the Py_InitModule4 redefining
205 # magic, so our Python modules should not be built to provide that either.
206 sed
-e
's/^#ifdef _DEBUG$/#if 0/' <$@
>$@.new
&& mv
$@.new
$@
211 ALLTAR
: $(PYVERSIONFILE
) $(PYVERSIONGFILE
)
212 .ENDIF
# "$(L10N_framework)"==""
214 # rule to allow relocating the whole framework, removing reference to buildinstallation directory
215 $(PACKAGE_DIR
)/fixscripts
: $(PACKAGE_DIR
)$/$(PREDELIVER_FLAG_FILE
)
216 @echo remove build installdir from scripts
217 $(COMMAND_ECHO
)for file in \
218 $(MYCWD
)/$(my_prefix
)/OOoPython.framework
/Versions
/$(PYMAJOR
).
$(PYMINOR
)/bin
/2to3 \
219 $(MYCWD
)/$(my_prefix
)/OOoPython.framework
/Versions
/$(PYMAJOR
).
$(PYMINOR
)/bin
/idle
$(PYMAJOR
).
$(PYMINOR
) \
220 $(MYCWD
)/$(my_prefix
)/OOoPython.framework
/Versions
/$(PYMAJOR
).
$(PYMINOR
)/bin
/pydoc
$(PYMAJOR
).
$(PYMINOR
) \
221 $(MYCWD
)/$(my_prefix
)/OOoPython.framework
/Versions
/$(PYMAJOR
).
$(PYMINOR
)/bin
/python
$(PYMAJOR
).
$(PYMINOR
)-config \
222 $(MYCWD
)/$(my_prefix
)/OOoPython.framework
/Versions
/$(PYMAJOR
).
$(PYMINOR
)/bin
/smtpd
$(PYMAJOR
).
$(PYMINOR
).py
; do \
223 {{ rm "$$file" && awk
'\
227 bindir=$$(cd $$(dirname \"$$0\") ; pwd)\n\
229 \"$$bindir/../Resources/Python.app/Contents/MacOS/OOoPython\" - $$@ <<EOF"}} \
232 END {{print "EOF"}}' > "$$file" ; }} < "$$file" ; chmod
+x
"$$file" ; done
235 $(PACKAGE_DIR
)/fixinstallnames
: $(PACKAGE_DIR
)$/$(PREDELIVER_FLAG_FILE
)
236 @echo remove build installdir from OOoPython
237 $(COMMAND_ECHO
)install_name_tool
-change \
238 /$(my_prefix
)/OOoPython.framework
/Versions
/$(PYMAJOR
).
$(PYMINOR
)/OOoPython \
239 @executable_path
/..
/..
/..
/..
/OOoPython \
240 $(MYCWD
)/$(my_prefix
)/OOoPython.framework
/Versions
/$(PYMAJOR
).
$(PYMINOR
)/Resources
/Python.app
/Contents
/MacOS
/OOoPython
243 $(MISC
)/OOoPython.framework.zip
: $(PACKAGE_DIR
)/fixinstallnames
$(PACKAGE_DIR
)/fixscripts
246 $(COMMAND_ECHO
)cd
$(MISC
)/build
/$(my_prefix
) && find OOoPython.framework \
247 -not
-type l
-not
-name Info.plist.in \
248 -not
-name pythonw
$(PYMAJOR
).
$(PYMINOR
) \
249 -not
-name python
$(PYMAJOR
).
$(PYMINOR
) -print0 | \
250 xargs
-0 zip
$(ZIP_VERBOSITY
) ..
/..
/$(@
:f
)
252 $(PYVERSIONFILE
) : pyversion.mk
$(PACKAGE_DIR
)$/$(PREDELIVER_FLAG_FILE
)
254 $(COMMAND_ECHO
)$(COPY
) pyversion.mk
$@
256 $(PYVERSIONGFILE
) : pyversion.Makefile
$(PACKAGE_DIR
)$/$(PREDELIVER_FLAG_FILE
)
258 $(COMMAND_ECHO
)$(COPY
) pyversion.Makefile
$@
260 .ENDIF
# DISABLE_PYTHON != TRUE