building my own ports of py27-matplotib and py27-numpy
Arturo Rinaldi
arty.net2 at gmail.com
Thu Nov 14 17:29:03 PST 2013
Il 15/11/13 01:37, Ryan Schmidt ha scritto:
> On Nov 14, 2013, at 15:27, Arturo Rinaldi wrote:
>
>> Hi folks, I need some help to build my own port of these two packages. I want to update them to their latest version (1.3.1 and 1.8.0 respectively) and I was using as basis the original Portfile file, we all know that just a few tweaks are necessary to achieve this goal.
>>
>> I only changed the version and the chekcsum in the Portfile, but it's not enough.....
> That sounds like a good first step. Why didn't it work? What error did you receive?
>
>
>
CRC error......there's a mismatch between the one detected by macports
and the one calculted by my checksum tool from the shell :
/$ shasum -a 256 numpy-1.8.0.tar.gz/
returns :
/
//2764d0819acc77e9ff81b060fe7f69530b0d85c26ac9d162639b787cb227d253 //
/
for the tar.gz file which is not the one macpors asks for. I am
attaching my custom Portfile to show you my changes....
Kind Regards,
Arturo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-users/attachments/20131115/2c5945de/attachment.html>
-------------- next part --------------
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id$
PortSystem 1.0
PortGroup python 1.0
PortGroup github 1.0
github.setup numpy numpy 1.8.0 v
name py27-numpy
revision 1
dist_subdir ${name}/${version}_1
categories-append math
license BSD
platforms darwin
maintainers dh michaelld openmaintainer
description The core utilities for the scientific library scipy for Python
long_description ${description}
checksums sha256 0fd329d90ce3e019ebcdebacc420f5f22e77794768fd8124df4de9480a90d600
python.versions 24 25 26 27 31 32 33
if {$subport != $name} {
patchfiles patch-f2py_setup.py.diff \
patch-numpy_distutils_fcompiler___init__.py.diff \
patch-fcompiler_g95.diff
depends_lib-append port:fftw-3 \
port:py${python.version}-nose
# http://trac.macports.org/ticket/34562
destroot.env-append \
CC="${configure.cc}" \
CFLAGS="${configure.cflags} [get_canonical_archflags cc]" \
CXX="${configure.cxx}" \
CXXFLAGS="${configure.cxxflags} [get_canonical_archflags cxx]" \
OBJC="${configure.objc}" \
OBJCFLAGS="${configure.objcflags} [get_canonical_archflags objc]" \
LDFLAGS="${configure.ldflags} [get_canonical_archflags ld]"
build.env-append ARCHFLAGS="[get_canonical_archflags ld]"
destroot.env-append ARCHFLAGS="[get_canonical_archflags ld]"
variant atlas description {Use the MacPorts' ATLAS libraries \
instead of Apple's Accelerate framework} {
build.env-append ATLAS=${prefix}/lib \
LAPACK=${prefix}/lib \
BLAS=${prefix}/lib
destroot.env-append ATLAS=${prefix}/lib \
LAPACK=${prefix}/lib \
BLAS=${prefix}/lib
depends_lib-append port:atlas
if {[variant_isset universal]} {
python.set_compiler no
}
}
# when using ATLAS (whether by default or specified by the user via
# the +atlas variant) ...
set gcc_version ""
if {[variant_isset atlas]} {
# see if the user has set -gcc4X to disable using MacPorts'
# compiler; if not, either use what the user set (as +gcc4X) or
# default to gcc47.
variant gcc43 conflicts gcc44 gcc45 gcc46 gcc47 gcc48 \
description {Use the gcc43 compiler (enables fortran linking)} {
configure.compiler macports-gcc-4.3
}
variant gcc44 conflicts gcc43 gcc45 gcc46 gcc47 gcc48 \
description {Use the gcc44 compiler (enables fortran linking)} {
configure.compiler macports-gcc-4.4
}
variant gcc45 conflicts gcc43 gcc44 gcc46 gcc47 gcc48 \
description {Use the gcc45 compiler (enables fortran linking)} {
configure.compiler macports-gcc-4.5
}
variant gcc46 conflicts gcc43 gcc44 gcc45 gcc47 gcc48 \
description {Use the gcc46 compiler (enables fortran linking)} {
configure.compiler macports-gcc-4.6
}
variant gcc47 conflicts gcc43 gcc44 gcc45 gcc46 gcc48 \
description {Use the gcc47 compiler (enables fortran linking)} {
configure.compiler macports-gcc-4.7
}
variant gcc48 conflicts gcc43 gcc44 gcc45 gcc46 gcc47 \
description {Use the gcc48 compiler (enables fortran linking)} {
configure.compiler macports-gcc-4.8
}
if {![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc45] && ![variant_isset gcc46] && ![variant_isset gcc48]} {
default_variants +gcc47
}
if {[variant_isset gcc43]} {
set gcc_version "4.3"
} elseif {[variant_isset gcc44]} {
set gcc_version "4.4"
} elseif {[variant_isset gcc45]} {
set gcc_version "4.5"
} elseif {[variant_isset gcc46]} {
set gcc_version "4.6"
} elseif {[variant_isset gcc47]} {
set gcc_version "4.7"
} elseif {[variant_isset gcc48]} {
set gcc_version "4.8"
}
# when using non-Apple GCC for universal install, it can
# create binaries only for the native OS architecture, at
# either 32 or 64 bits. Restrict the supported archs
# accordingly.
if {${os.arch} == "i386"} {
supported_archs i386 x86_64
} elseif {${os.arch} == "powerpc"} {
supported_archs ppc ppc64
}
# include all the correct GCC4X port
depends_lib-append port:gcc[join [split ${gcc_version} "."] ""]
# force LDFLAGS for correct linking of the linalg module
# for non-Apple GCC compilers
patchfiles-append patch-numpy_linalg_setup.py.diff
if {${gcc_version} == ""} {
# user specified -gcc4X but +atlas (either as default or
# explicitly); do not allow since it might lead to
# undetermined runtime execution.
return -code error \
"\n\nWhen using the +atlas variant (either as the default or setting
explicitly), one of the +gcc4X variants must be selected.\n"
}
} else {
variant universal {
patchfiles-append patch-setup.py.diff
}
}
post-patch {
reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" \
${worksrcpath}/numpy/f2py/setup.py
if {[variant_isset universal] && [variant_isset atlas]} {
# Prepare wrappers
file copy -force ${filespath}/wrapper-template \
${worksrcpath}/c-wrapper
file copy -force ${filespath}/wrapper-template \
${worksrcpath}/f-wrapper
file copy -force ${filespath}/wrapper-template \
${worksrcpath}/cxx-wrapper
reinplace "s|@@@|${configure.cc}|" ${worksrcpath}/c-wrapper
reinplace "s|---|\\\\.c|" ${worksrcpath}/c-wrapper
reinplace "s|&&&|${prefix}|" ${worksrcpath}/c-wrapper
reinplace "s|@@@|${configure.cxx}|" ${worksrcpath}/cxx-wrapper
reinplace "s#---#(\\\\.C|\\\\.cpp|\\\\.cc)#" \
${worksrcpath}/cxx-wrapper
reinplace "s|&&&|${prefix}|" ${worksrcpath}/cxx-wrapper
reinplace "s|@@@|${configure.f90}|" ${worksrcpath}/f-wrapper
reinplace "s|---|\\\\.f|" ${worksrcpath}/f-wrapper
reinplace "s|&&&|${prefix}|" ${worksrcpath}/f-wrapper
build.env-append CC="${worksrcpath}/c-wrapper" \
CXX="${worksrcpath}/cxx-wrapper" \
F77="${worksrcpath}/f-wrapper" \
F90="${worksrcpath}/f-wrapper"
destroot.env-append CC="${worksrcpath}/c-wrapper" \
CXX="${worksrcpath}/cxx-wrapper" \
F77="${worksrcpath}/f-wrapper" \
F90="${worksrcpath}/f-wrapper"
}
if {[variant_isset atlas]} {
# We must link against libSatlas or libTatlas, not libAtlas
if {[file exists ${prefix}/lib/libtatlas.dylib]} {
reinplace -E \
"s|_lib_atlas = \\\['atlas'\\\]|_lib_atlas = \\\['tatlas'\\\]|" \
${worksrcpath}/numpy/distutils/system_info.py
} elseif {[file exists ${prefix}/lib/libsatlas.dylib]} {
reinplace -E \
"s|_lib_atlas = \\\['atlas'\\\]|_lib_atlas = \\\['satlas'\\\]|" \
${worksrcpath}/numpy/distutils/system_info.py
} else {
return -code error "Unable to find Atlas dylibs. Bailing out."
}
}
}
livecheck.type none
} else {
livecheck.regex archive/[join ${github.tag_prefix} ""](\[\\d+(?:\\.\\d+)*"\]+)${extract.suffix}"
}
-------------- next part --------------
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id$
PortSystem 1.0
PortGroup python 1.0
PortGroup github 1.0
github.setup matplotlib matplotlib 1.3.1 v
name py27-matplotlib
revision 0
categories-append graphics math
platforms darwin
license {PSF BSD}
python.versions 26 27 31 32 33
maintainers sean openmaintainer
description Matplotlib is a python plotting library
long_description Matplotlib strives to produce publication quality 2D \
graphics for interactive graphing, scientific publishing, \
user interface development and web application servers \
targeting multiple user interfaces and hardcopy output \
formats. There is a 'pylab' mode which emulates matlab \
graphics. The library uses numpy for handling large data \
sets and supports a variety of output backends. This port \
provides variants for the different GUIs (gtk2, tkinter, \
qt4, cairo, latex).
homepage http://matplotlib.org/
if {${name} != ${subport}} {
depends_build-append \
port:pkgconfig
depends_lib-append port:freetype \
port:libpng \
port:py27-numpy \
port:py27-tz \
port:py27-dateutil \
port:py27-parsing \
port:py27-six \
port:py27-pyobjc-cocoa
patchfiles-append patch-setup.cfg.diff \
patch-setupext.py.diff
build.env PKG_CONFIG_PATH="${python.prefix}/lib/pkgconfig"
post-patch {
reinplace "s|@@PREFIX@@|${prefix}|" ${worksrcpath}/setup.cfg
}
# build fails with gcc-4.0 on Leopard, use gcc-4.2 (#37069)
compiler.blacklist gcc-4.0
post-destroot {
if {${name} != ${subport}} {
xinstall -m 755 -d ${destroot}${prefix}/share/doc/${subport} \
${destroot}${prefix}/share/${subport}
xinstall -m 644 -W ${worksrcpath} CHANGELOG README.rst TODO matplotlibrc.template \
${destroot}${prefix}/share/doc/${subport}
file copy ${worksrcpath}/examples \
${destroot}${prefix}/share/${subport}
}
}
variant webagg description "Enable WebAgg backend" {
depends_run-append port:py27-tornado
}
variant tkinter description "Enable tkAgg backend" {
depends_lib-append port:py27-tkinter
post-patch {
reinplace "s|^tkagg=False|tkagg=True|" ${worksrcpath}/setup.cfg
}
}
variant gtk2 description "Enable GTKAgg backend" {
depends_lib-append port:py27-pygtk
post-patch {
reinplace "s|^gtk=False|gtk=True|" ${worksrcpath}/setup.cfg
reinplace "s|^gtkagg=False|gtkagg=True|" ${worksrcpath}/setup.cfg
}
}
variant qt4 description "Enable QT4Agg backend" {
depends_lib-append port:py27-pyqt4
post-patch {
reinplace "s|^qt4agg=False|qt4agg=True|" ${worksrcpath}/setup.cfg
}
}
variant pyside description "Enable PySide backend" {
depends_lib-append port:py27-pyside
patchfiles-append patch-setup.py.diff
post-patch {
reinplace "s|^pyside=False|pyside=True|" ${worksrcpath}/setup.cfg
}
}
variant cairo description "Enable Cairo backends" {
depends_lib-append port:py27-cairo
post-patch {
reinplace "s|^cairo=False|cairo=True|" ${worksrcpath}/setup.cfg
}
}
variant dvipng description "Enable dvipng support" {
depends_run-append port:dvipng
}
variant ghostscript description "Enable GhostScript support" {
depends_run-append port:ghostscript
}
variant latex description "Enable LaTeX support" {
depends_run-append bin:latex:texlive
}
variant pdftops description "Enable pdftops support" {
depends_run-append bin:pdftops:poppler
}
if { ![variant_isset gtk2] && ![variant_isset tkinter] && ![variant_isset qt4] && ![variant_isset pyside] } {
default_variants +tkinter
}
livecheck.type none
notes "
The default backend is the interactive Mac OS X backend. Different\
backends can be specified using the ~/.matplotlib/matplotlibrc file.\
More details regarding backends can be found in the matplotlib FAQ:
http://matplotlib.sourceforge.net/faq/installing_faq.html#what-is-a-backend
"
} else {
livecheck.regex archive/[join ${github.tag_prefix} ""](\[\\d+(?:\\.\\d+)*"\]+)${extract.suffix}"
}
More information about the macports-users
mailing list