Ticket #41241: Portfile

File Portfile, 8.5 KB (added by ChristianFrisson (Christian Frisson), 7 years ago)
Line 
1# -*- 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
2# $Id: Portfile 115019 2013-12-22 09:29:46Z ryandesign@macports.org $
3
4PortSystem      1.0
5PortGroup       github 1.0
6
7#PortGroup       cmake 1.0
8# ffmpeg, optional dependency, currenly requires openjpeg15, but vxl uses/packs openjpeg (2.0)
9# The cmake portgroup includes the prefix as cflags, what prevent internal openjpeg paths to be included before all others, even through include_directories(BEFORE ...)
10# https://trac.macports.org/ticket/42872
11# currently append ${prefix}/var/macports/sources/rsync.macports.org/release/tarballs/ports/_resources/port1.0/group/cmake-1.0.tcl it here until the issue is resolved
12# standard place to install extra CMake modules
13set cmake_share_module_dir ${prefix}/share/cmake/modules
14
15depends_build-append port:cmake
16
17#FIXME: ccache works with cmake on linux
18configure.ccache    no
19
20configure.cmd       ${prefix}/bin/cmake
21
22configure.pre_args  -DCMAKE_INSTALL_PREFIX=${prefix}
23
24configure.args      -DCMAKE_VERBOSE_MAKEFILE=ON \
25                    -DCMAKE_COLOR_MAKEFILE=ON \
26                    -DCMAKE_BUILD_TYPE=Release \
27                    -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
28                    -DCMAKE_INSTALL_RPATH=${prefix}/lib \
29                    -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib \
30                    -DCMAKE_SYSTEM_PREFIX_PATH="${prefix}\;/usr" \
31                    -DCMAKE_MODULE_PATH=${cmake_share_module_dir} \
32                    -DCMAKE_FIND_FRAMEWORK=LAST \
33                    -Wno-dev
34
35# CMake honors set environment variables CFLAGS, CXXFLAGS, and LDFLAGS when it
36# is first run in a build directory to initialize CMAKE_C_FLAGS,
37# CMAKE_CXX_FLAGS, CMAKE_[EXE|SHARED|MODULE]_LINKER_FLAGS. However, be aware
38# that a CMake script can always override these flags when it runs, as they
39# are frequently set internally in functions of other CMake build variables!
40#
41# Attention: If you want to be sure that no compiler flags are passed via
42# configure.args, you have to manually clear configure.optflags, as it is set
43# to "-Os" by default and added to all language-specific flags. If you want to
44# turn off optimization, explicitly set configure.optflags to "-O0".
45
46# TODO: Handle configure.objcflags (cf. to CMake upstream ticket #4756
47#       "CMake needs an Objective-C equivalent of CMAKE_CXX_FLAGS"
48#       <http://public.kitware.com/Bug/view.php?id=4756>)
49
50# TODO: Handle the Fortran-specific configure.* variables:
51#       configure.fflags, configure.fcflags, configure.f90flags
52
53# TODO: Handle the Java-specific configure.classpath variable.
54
55pre-configure {
56    # The environment variable CPPFLAGS is not considered by CMake.
57    # (CMake upstream ticket #12928 "CMake silently ignores CPPFLAGS"
58    # <http://www.cmake.org/Bug/view.php?id=12928>).
59    # Thus, we have to add them manually to the CFLAGS and CXXFLAGS in the
60    # pre-configure phase.
61#    if {${configure.cppflags} ne ""} {
62#        configure.cflags-append ${configure.cppflags}
63#        configure.cxxflags-append ${configure.cppflags}
64#    }
65
66    # In addition, CMake provides build-type-specific flags for
67    # Release (-O3 -DNDEBUG), Debug (-g), MinSizeRel (-Os -DNDEBUG), and
68    # RelWithDebInfo (-O2 -g -DNDEBUG). If the configure.optflags have been
69    # set (-Os by default), we have to remove the optimization flags from the
70    # from the concerned Release build type so that configure.optflags
71    # gets honored (Debug used by the +debug variant does not set
72    # optimization flags by default).
73    if {${configure.optflags} ne ""} {
74        configure.args-append -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" \
75                              -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG"
76    }
77
78    platform darwin {
79        if {[variant_exists universal] && [variant_isset universal]} {
80            if {[info exists universal_archs_supported]} {
81                global merger_configure_args
82                foreach arch ${universal_archs_to_use} {
83                    lappend merger_configure_args(${arch}) -DCMAKE_OSX_ARCHITECTURES=${arch}
84                }
85            } else {
86                configure.universal_args-append \
87                    -DCMAKE_OSX_ARCHITECTURES="[join ${configure.universal_archs} \;]"
88            }
89        } else {
90            configure.args-append \
91                -DCMAKE_OSX_ARCHITECTURES="${configure.build_arch}"
92        }
93        if {${configure.sdkroot} != ""} {
94            configure.args-append -DCMAKE_OSX_SYSROOT="${configure.sdkroot}"
95        } else {
96            # Witout this, cmake will choose an SDK and deployment target on its own.
97            configure.args-append -DCMAKE_OSX_SYSROOT=/ -DCMAKE_OSX_DEPLOYMENT_TARGET=""
98        }
99    }
100}
101
102configure.universal_args-delete --disable-dependency-tracking
103
104variant debug description "Enable debug binaries" {
105    configure.args-delete   -DCMAKE_BUILD_TYPE=Release
106    configure.args-append   -DCMAKE_BUILD_TYPE=Debug
107}
108
109# cmake doesn't like --enable-debug, so in case a portfile sets
110# --enable-debug (regardless of variant) we remove it
111if {[string first "--enable-debug" ${configure.args}] > -1} {
112    configure.args-delete     --enable-debug
113}
114# end of copy
115
116github.setup    vxl vxl 22e5ccd9fa
117name            vxl
118version         1.17.0
119revision        2
120set branch      [join [lrange [split ${version} .] 0 1] .]
121categories      devel
122maintainers     nomaintainer gmail:christian.frisson
123description     C++ libraries for computer vision
124long_description \
125    VXL (the Vision-something-Libraries) is a collection of C++ libraries \
126    designed for computer vision research and implementation. It was \
127    created from TargetJr and the IUE with the aim of making a light, \
128    fast and consistent system. VXL is written in ANSI/ISO C++ and is \
129    designed to be portable over many platforms.
130homepage        http://vxl.sourceforge.net/
131platforms       darwin
132
133# Checksums for non-git release
134#master_sites    sourceforge:project/vxl/vxl/${branch}
135#use_zip         yes
136#checksums       md5     95b5ecbbe164d1b540ab52fd0ca26b47 \
137#                sha1    bfa7e9df3fb8807ef3b14921c31d568e94f3edf4 \
138#                rmd160  a00d811aa86b2d3a2dad292ff94991c034092434
139
140# Checksums for git version
141checksums           md5     7858eaa862f150fe78031e2a37fbe1d9 \
142                    sha1    b6068e8145244f6fb12ba739e94ed668630e8474 \
143                    rmd160  5c8ce5bfa9911149cf71906e5d36081d26ad77bd
144
145# licenses in vxl:
146# (see also: http://anonscm.debian.org/viewvc/debian-med/trunk/packages/vxl/trunk/debian/copyright?revision=10688&view=markup)
147# BSD       for core
148# GPL-2+    for v3p/Qv/*
149# zlib      for v3p/zlib/*
150# GPL-2+    for v3p/mpeg2/libmpeg2/*
151# MIT       for v3p/geotiff/*
152# Boost     for core/vul/vul_ios_state.h
153# Boost     for contrib/rpl/rgrl/*
154# MIT/X11   for contrib/brl/b3p/shapelib/* (or LGPL-something)
155# zlib      for contrib/brl/b3p/minizip/*
156# GPL-2+    for vidl_vil1/vidl_vil1_mpegcodec.cxx and vidl1/vidl1_mpegcodec.cxx
157# Boost     for vcl_atomic_count.h and vcl/internal/*
158license         BSD GPL-2+ zlib MIT Boost
159
160# ensure that embedded openjpeg2 openjpeg.h takes precedence over that from external openjpeg15 or openjpeg
161# disable ffmpeg support that fails to build with current ffmpeg versions
162# disable broken contrib/prip code
163
164# Patches for non-git release
165#patchfiles      patch-use-embedded-openjpeg2.diff \
166#                patch-disable-broken-ffmpeg.diff \
167#                patch-disable-contrib-prip.diff
168
169# Patches for git version
170patchfiles      patch-fix-include-openjpeg.diff \
171                patch-fix-ffmpeg-support.diff \
172                patch-fix-find-X11.diff
173               
174depends_lib-append \
175                port:jpeg \
176                port:tiff \
177                port:libgeotiff \
178                port:libpng \
179                port:zlib \
180                port:bzip2 \
181                port:libdc1394
182
183# This fails with the git version
184#if {[string match *clang* ${configure.compiler}]} {
185#    configure.cxxflags-append -Werror=gnu -Wno-error=vla
186#}
187
188configure.args-append \
189    -DBUILD_SHARED_LIBS=YES \
190    -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib/${name} \
191    -DBUILD_BRL=NO \
192    -DVXL_FORCE_V3P_OPENJPEG2=ON
193
194# shuffle directories around to turn ${prefix}/lib into ${prefix}/lib/${name}
195post-destroot {
196    file rename ${destroot}${prefix}/lib ${destroot}${prefix}/tmp
197    file mkdir ${destroot}${prefix}/lib
198    file rename ${destroot}${prefix}/tmp ${destroot}${prefix}/lib/${name}
199
200    # for some reason this file doesn't get installed, making rev-upgrade complain
201    xinstall -m 755 ${worksrcpath}/lib/libvpgl.dylib ${destroot}${prefix}/lib/${name}
202}
203
204livecheck.regex /${name}-(\[0-9.\]+)${extract.suffix}