summaryrefslogtreecommitdiffstats
path: root/packaging/macosx/ports/lang/python26/Portfile
blob: c72cd28d5e6e7370ce3f46c3a1e1545e3580b256 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# $Id: Portfile 49077 2009-04-03 07:13:13Z erickt@macports.org $

PortSystem 1.0
PortGroup select 1.0

name                    python26
version                 2.6.1
revision                100
set major               [lindex [split $version .] 0]
set branch              [join [lrange [split ${version} .] 0 1] .]
categories              lang
platforms               darwin
maintainers             blb mcalhoun

description             An interpreted, object-oriented programming language
long_description        Python is an interpreted, interactive, object-oriented \
                        programming language.

homepage                http://www.python.org/
master_sites            ${homepage}/ftp/python/${version}/ \
                        ftp://ftp.python.org/pub/python/${version}/

distname                Python-${version}
use_bzip2               yes

checksums               md5     e81c2f0953aa60f8062c05a4673f2be0 \
                        sha1    419f0cb29e9713ea861dde8c43d107c51329e57b \
                        rmd160  497dafaca9c150fca611b0175eeb13c2fc4d3e2d

# patch-Lib-distutils-dist.py.diff comes from
# <http://bugs.python.org/issue1180>
patchfiles              patch-Makefile.pre.in.diff \
                        patch-setup.py.diff \
                        patch-Lib-cgi.py.diff \
                        patch-Lib-distutils-dist.py.diff \
                        patch-Mac-IDLE-Makefile.in.diff \
                        patch-Mac-Makefile.in.diff \
                        patch-Mac-PythonLauncher-Makefile.in.diff \
                        patch-Mac-Tools-Doc-setup.py.diff

depends_lib             port:gettext port:zlib port:openssl port:tk \
                        port:sqlite3 port:db46 port:ncurses port:gdbm \
                        port:bzip2 port:readline

configure.args          --enable-framework=${frameworks_dir} \
                        --enable-ipv6

use_parallel_build      no

post-patch {
   reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/Lib/cgi.py
   reinplace "s|@@APPLICATIONS_DIR@@|${applications_dir}|g" \
      ${worksrcpath}/Mac/Makefile.in ${worksrcpath}/Mac/IDLE/Makefile.in \
      ${worksrcpath}/Mac/Tools/Doc/setup.py \
      ${worksrcpath}/Mac/PythonLauncher/Makefile.in

   # See http://trac.macports.org/changeset/37861
   reinplace "s|xargs -0 rm -r|/usr/bin/xargs -0 /bin/rm -r|g" \
      ${worksrcpath}/Mac/PythonLauncher/Makefile.in
}

build.target            all

test.run                yes
test.target             test

destroot.target         frameworkinstall maninstall

# ensure that correct compiler is used
build.args-append       MAKE="${build.cmd} CC=${configure.cc}"
destroot.args-append    MAKE="${destroot.cmd} CC=${configure.cc}"

select.group            python
select.file             ${filespath}/python[string map {. {}} ${branch}]

post-destroot {
   set framewpath ${frameworks_dir}/Python.framework
   set framewdir  ${framewpath}/Versions/${branch}

   foreach dir { Headers Resources Python Versions/Current } {
      file delete ${destroot}${framewpath}/${dir}
   }

   ln -s ${framewdir}/share/man/man1/python.1 ${destroot}${prefix}/share/man/man1/python${branch}.1

   # Without this, LINKFORSHARED is set to 
   # ... $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
   # (this becomes Python.framework/Versions/2.6/Python) which doesn't
   # quite work (see ticket #15099); instead specifically list the
   # full path to the proper Python framework file (which becomes
   # ${prefix}/Library/Frameworks/Python.framework/Versions/2.6/Python)
   reinplace {s|^\(LINKFORSHARED=.*\)$(PYTHONFRAMEWORKDIR).*$|\1 $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)|} ${destroot}${framewdir}/lib/python${branch}/config/Makefile

   # The framework version.plist isn't currently being installed so
   # we'll copy ours for now (see http://trac.macports.org/ticket/18773 and
   # http://bugs.python.org/issue4937)
   xinstall -m 644 ${filespath}/version.plist \
      ${destroot}${framewdir}/Resources/version.plist
}

post-activate {
   ui_msg "\nTo fully complete your installation and make python $branch the default, please run
\n\tsudo port install python_select \
\n\tsudo python_select $name\n"
}

platform darwin {
   post-configure {
      # See http://trac.macports.org/ticket/18376
      system "cd ${worksrcpath} && ed - pyconfig.h < ${filespath}/pyconfig.ed"
   }
}

platform darwin 7 {
   # there is no SystemStubs on 10.3
   post-patch {
      reinplace "s|-lSystemStubs||g" ${worksrcpath}/configure \
         ${worksrcpath}/configure.in
   }
   post-configure {
      reinplace "s|-lSystemStubs||g" ${worksrcpath}/Makefile.pre.in \
         ${worksrcpath}/Makefile.pre ${worksrcpath}/Makefile
   }
   # To avoid GCC incompatibility issue. See http://nxg.me.uk/note/2004/restFP/ (by ebgssth at gmail.com, ticket #13322)
   configure.ldflags-append   "-lcc_dynamic"
}

platform darwin 10 {
   configure.compiler   gcc-4.2
}

variant universal {
   post-patch {
      set universal_arch_flags {}
      set arch_run_32bit {}
      foreach arch ${universal_archs} {
         lappend universal_arch_flags -arch ${arch}
         if { ${arch}=="i386" || ${arch}=="ppc" } {
            lappend arch_run_32bit -${arch}
         }
      }
      reinplace \
         "s|UNIVERSAL_ARCH_FLAGS=\".*\"|UNIVERSAL_ARCH_FLAGS=\"${universal_arch_flags}\"|" \
         ${worksrcpath}/configure
      reinplace \
         "s|ARCH_RUN_32BIT=\".*\"|ARCH_RUN_32BIT=\"arch ${arch_run_32bit}\"|" \
         ${worksrcpath}/configure
   }
   configure.args-append   --enable-universalsdk=${universal_sysroot}
}

variant ucs4 description {Enable support for UCS4} {
   configure.args-append   --enable-unicode=ucs4
}

#livecheck.check         regex
#livecheck.url           ${homepage}download/releases/
#livecheck.regex         Python (${branch}(?:\\.\\d+)*)