# -*- 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: python-1.0.tcl 118101 2014-03-22 15:16:34Z jmr@macports.org $
#
# Copyright (c) 2011 The MacPorts Project
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# 3. Neither the name of The MacPorts Project nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Usage:
# name should be of the form py-foo for modules
# subports pyXY-foo are declared for each XY in python.versions
# for apps (i.e. not named py-foo), no subports will be defined
# only the python.default_version will be used
# you can change that in variants if you want
# options:
# python.versions: which versions this module supports, e.g. "26 27 31"
# always set this (even if you have your own subport blocks)
# python.default_version: which version will be installed if the user asks
# for py-foo rather than pyXY-foo
#
# Note: setting these options requires name to be set beforehand
# we want the default universal variant added despite not using configure
}
proc python_get_version {} {
} else {
return [option python.default_version]
}
}
proc python_get_default_version {} {
return 27
} else {
}
} else {
return 27
}
}
return
}
foreach v [option $option] {
}
# set up py-foo as a stub port that depends on the default pyXY-foo
fetch {}
checksum {}
extract {}
patch {}
build {}
destroot {
}
} else {
}
} else {
}
if {${python.add_archflags}} {
OBJCFLAGS="${configure.universal_cflags}" \
CXXFLAGS="${configure.universal_cxxflags}" \
LDFLAGS="${configure.universal_ldflags}"
} else {
OBJCFLAGS="${configure.objc_archflags}" \
CXXFLAGS="${configure.cxx_archflags}" \
FFLAGS="${configure.f77_archflags}" \
F90FLAGS="${configure.f90_archflags}" \
FCFLAGS="${configure.fc_archflags}" \
LDFLAGS="${configure.ld_archflags}"
}
}
if {${python.set_compiler}} {
}
}
}
}
if {${python.link_binaries}} {
if {[catch {file type "${destroot}${prefix}/bin/${bin}${python.link_binaries_suffix}"}]} {
}
}
}
if {${python.move_binaries}} {
}
}
}
}
}
return
}
}
} else {
}
}
# for pythonXY, python.branch is X.Y
default python.branch {[string range ${python.version} 0 end-1].[string index ${python.version} end]}
switch -- $var {
prefix {
global build_arch frameworks_dir
set ret "${frameworks_dir}/Python.framework/Versions/${python.branch}"
}
return $ret
}
bin {
return "${python.prefix}/bin/python${python.branch}"
} else {
return "${prefix}/bin/python${python.branch}"
}
}
include {
set inc_dir "${python.prefix}/include/python${python.branch}"
return ${inc_dir}
} else {
# look for "${inc_dir}*" and pick the first one found;
# make assumptions if none are found
return ${inc_dir}
} else {
}
} else {
}
}
}
lib {
return "${python.prefix}/Python"
} else {
return "${prefix}/lib/lib${python.branch}.dylib"
}
}
pkgd {
return "${python.prefix}/lib/python${python.branch}/site-packages"
} else {
return "${prefix}/lib/python${python.branch}/site-packages"
}
}
return "--no-user-cfg"
} else {
return ""
}
}
return "${python.prefix}"
} else {
return "${prefix}"
}
}
return yes
} else {
return no
}
}
return yes
} else {
return no
}
}
default {
error "unknown option $var"
}
}
}
options python.add_archflags
options python.set_compiler