Skip to content
Permalink
Browse files

libiio: update to 0.19

Deprecate the devel port in favor of the release port.
Various fixups for the new release port to build and install cleanly.
  • Loading branch information
michaelld committed May 16, 2020
1 parent f3060a7 commit 5448a392efe4cf167d5fa660a39f2b17cb407af2
Showing with 159 additions and 243 deletions.
  1. +121 −147 science/libiio/Portfile
  2. +0 −61 science/libiio/files/patch-fix_build.devel.diff
  3. +38 −35 science/libiio/files/patch-fix_build.release.diff
@@ -1,7 +1,7 @@
# -*- 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

PortSystem 1.0
PortGroup cmake 1.0
PortGroup cmake 1.1
PortGroup github 1.0

name libiio
@@ -12,19 +12,24 @@ long_description ${description}. The IIO subsystem is intended to provide sup
license LGPL-2+
platforms darwin

subport libiio-devel {}
subport libiio-devel {
# releases happen here often enough to not require this port
replaced_by libiio
PortGroup obsolete 1.0

# final version of the devel, with +1 rev bump
version 20200110-3d582f2f
revision 1
}

if {${subport} eq ${name}} {

# release
github.setup analogdevicesinc libiio 0.18 v
checksums rmd160 5faff3b0ee29b077b21c013b6722d5e090017792 \
sha256 aa585c34ee536828add315d002458e4f8469867a8c4d2bffa4eda0de1956b168 \
size 201765
revision 1

# stealth update of some sort; remove at the next release
dist_subdir ${name}/${version}_1
github.setup analogdevicesinc libiio 0.19 v
checksums rmd160 e21e15a19ca9af2d597babd49151e3a993a21aeb \
sha256 ab0ff9d373d3999f7269cab4a9bc13fdcd6b9113e2ddef0c521864c89494dc54 \
size 226022
revision 0

long_description ${long_description} Provides the release, which is typically updated every few months to yearly.
# because I moved from a "devel" style 20190503 to a release style
@@ -35,169 +40,138 @@ if {${subport} eq ${name}} {

patchfiles-append patch-fix_build.release.diff

# additional arguments
configure.args-append \
-DCMAKE_INSTALL_MP_FRAMEWORKS_DIR=${frameworks_dir}

} else {

#devel
github.setup analogdevicesinc libiio 3d582f2ff01452c17df597fecaa548c419e107a1
version 20200110-[string range ${github.version} 0 7]
checksums rmd160 fd3aa47aa030c739a0441402e00b2c7709f0efc6 \
sha256 12a5f33da3335e08085a5dcc899732a7f9171834bc308c9b1dd29a4b59c1a157 \
size 203094
revision 0

long_description ${long_description} Provides the GIT master branch version, which is typically updated every few days to weeks.

# patch to fix install directory of the framework

patchfiles-append patch-fix_build.devel.diff

# additional arguments
configure.args-append \
-DCMAKE_INSTALL_DOCDIR=${prefix}/share/doc/${github.project} \
-DOSX_INSTALL_FRAMEWORKSDIR=${prefix}/Library/Frameworks

}

depends_lib-append \
port:libxml2 \
path:lib/libusb.dylib:libusb \
port:avahi \
port:xz \
port:zlib \
port:libiconv

depends_build-append \
port:pkgconfig \
port:doxygen

# do VPATH (out of source tree) build

cmake.out_of_source yes

# remove top-level library path, such that internal libraries are used
# instead of any already-installed ones.

configure.ldflags-delete -L${prefix}/lib

# directory to install all CMake files; internal appends "uhd"

configure.args-append \
-DAVAHI_CLIENT_LIBRARIES=${prefix}/lib/libavahi-client.dylib \
-DAVAHI_COMMON_LIBRARIES=${prefix}/lib/libavahi-common.dylib \
-DLIBLZMA_INCLUDE_DIR:PATH=${prefix}/include \
-DLIBLZMA_LIBRARY:FILEPATH=${prefix}/lib/liblzma.dylib \
-DLIBUSB_INCLUDE_DIR:PATH=${prefix}/include \
-DLIBUSB_LIBRARIES:FILEPATH=${prefix}/lib/libusb-1.0.dylib \
-DZLIB_INCLUDE_DIR:PATH=${prefix}/include \
-DZLIB_LIBRARY_RELEASE:FILEPATH=${prefix}/lib/libz.dylib \
-DOSX_PACKAGE=OFF \
-DWITH_MATLAB_BINDINGS_API=OFF
depends_lib-append \
port:libxml2 \
path:lib/libusb.dylib:libusb \
port:avahi \
port:xz \
port:zlib \
port:libiconv

# specify the Python dependencies; these are checked for at configure,
# then used for building, but not at runtime.
depends_build-append \
port:pkgconfig \
port:doxygen

set pythons_suffixes {27 35 36 37 38}
# remove top-level library path, such that internal libraries are used
# instead of any already-installed ones.

set pythons_ports {}
foreach s ${pythons_suffixes} {
lappend pythons_ports python${s}
}
configure.ldflags-delete -L${prefix}/lib

foreach s ${pythons_suffixes} {
set p python${s}
set v [string index ${s} 0].[string index ${s} 1]
set i [lsearch -exact ${pythons_ports} ${p}]
set c [lreplace ${pythons_ports} ${i} ${i}]
variant ${p} description "Build ${name} using Python ${v}" conflicts {*}${c} ""
}
# directory to install all CMake files; internal appends "uhd"

# default to Py37 if not selected by the user
set selected_python_no_dot 37
foreach s ${pythons_suffixes} {
if {[variant_isset python${s}]} {
set selected_python_no_dot ${s}
configure.args-append \
-DAVAHI_CLIENT_LIBRARIES=${prefix}/lib/libavahi-client.dylib \
-DAVAHI_COMMON_LIBRARIES=${prefix}/lib/libavahi-common.dylib \
-DAVAHI_SERVICE_INSTALL_DIR=${prefix}/etc/avahi/services \
-DLIBLZMA_INCLUDE_DIR:PATH=${prefix}/include \
-DLIBLZMA_LIBRARY:FILEPATH=${prefix}/lib/liblzma.dylib \
-DLIBUSB_INCLUDE_DIR:PATH=${prefix}/include/libusb-1.0 \
-DLIBUSB_LIBRARIES:FILEPATH=${prefix}/lib/libusb-1.0.dylib \
-DZLIB_INCLUDE_DIR:PATH=${prefix}/include \
-DZLIB_LIBRARY_RELEASE:FILEPATH=${prefix}/lib/libz.dylib \
-DOSX_PACKAGE=OFF \
-DWITH_MATLAB_BINDINGS_API=OFF \
-DPYTHON_BINDINGS=ON

# specify the Python dependencies; these are checked for at configure,
# then used for building, but not at runtime.

set pythons_suffixes {27 35 36 37 38}

set pythons_ports {}
foreach s ${pythons_suffixes} {
lappend pythons_ports python${s}
}
}
default_variants +python${selected_python_no_dot}

# make sure the default python variant wasn't
# deselected without selecting another one
set selected_python_no_dot ""
foreach s ${pythons_suffixes} {
if {[variant_isset python${s}]} {
set selected_python_no_dot ${s}

foreach s ${pythons_suffixes} {
set p python${s}
set v [string index ${s} 0].[string index ${s} 1]
set i [lsearch -exact ${pythons_ports} ${p}]
set c [lreplace ${pythons_ports} ${i} ${i}]
variant ${p} description "Build ${name} using Python ${v}" conflicts {*}${c} ""
}
}

if {${selected_python_no_dot} eq ""} {
set py_vars ""
set final_s [lindex ${pythons_suffixes} end]
# default to Py37 if not selected by the user
set selected_python_no_dot 37
foreach s ${pythons_suffixes} {
if {${s} eq ${final_s}} {
set py_vars "${py_vars}or "
}
set py_vars "${py_vars}+python${s}"
if {${s} ne ${final_s}} {
set py_vars "${py_vars}, "
if {[variant_isset python${s}]} {
set selected_python_no_dot ${s}
}
}
ui_error "\n\nYou must select one of the variants ${py_vars}.\n"
return -code error "Invalid variant selection"
}
default_variants +python${selected_python_no_dot}

set selected_python_with_dot [join [split ${selected_python_no_dot} ""] "."]
# make sure the default python variant wasn't
# deselected without selecting another one
set selected_python_no_dot ""
foreach s ${pythons_suffixes} {
if {[variant_isset python${s}]} {
set selected_python_no_dot ${s}
}
}

set python_top_dir ${frameworks_dir}/Python.framework/Versions/${selected_python_with_dot}
if {${selected_python_no_dot} eq ""} {
set py_vars ""
set final_s [lindex ${pythons_suffixes} end]
foreach s ${pythons_suffixes} {
if {${s} eq ${final_s}} {
set py_vars "${py_vars}or "
}
set py_vars "${py_vars}+python${s}"
if {${s} ne ${final_s}} {
set py_vars "${py_vars}, "
}
}
ui_error "\n\nYou must select one of the variants ${py_vars}.\n"
return -code error "Invalid variant selection"
}

set python_name python${selected_python_with_dot}
set selected_python_with_dot [join [split ${selected_python_no_dot} ""] "."]

# required Python
set python_top_dir ${frameworks_dir}/Python.framework/Versions/${selected_python_with_dot}

depends_lib-append port:python${selected_python_no_dot}
set python_name python${selected_python_with_dot}

# specify the Python version to use; currently depends on port version
# required Python

if {${subport} eq ${name}} {
configure.args-append \
-DPYTHON_EXECUTABLE=${python_top_dir}/bin/${python_name}
} else {
depends_lib-append port:python${selected_python_no_dot}
configure.args-append \
-DPython_EXECUTABLE=${python_top_dir}/bin/${python_name}
}

post-destroot {
# move Python install to frameworks_dir for Python
set py_install_dir ${python_top_dir}/lib
xinstall -m 755 -d ${destroot}${py_install_dir}
move ${destroot}${prefix}/lib/${python_name} ${destroot}${py_install_dir}

# link from iio.framework to normal
set iio_framework_version 0.18
set iio_framework_top ${frameworks_dir}/iio.framework
set iio_framework ${iio_framework_top}/Versions/${iio_framework_version}/iio
set iio_dr_framework_top ${destroot}${iio_framework_top}

# fix iio library & link it into .../lib
xinstall -m 755 -d ${destroot}${prefix}/lib
ln -s ${iio_framework_top}/Versions/${iio_framework_version}/iio ${destroot}${prefix}/lib/libiio.dylib
system "install_name_tool -id ${iio_framework} ${destroot}${iio_framework}"

# fix Tools, and link them into .../bin
xinstall -m 755 -d ${destroot}${prefix}/bin
foreach app [glob ${iio_dr_framework_top}/Tools/*] {
set non_dr_app [strsed ${app} "s@${destroot}@@"]
set lib_iio_framework [strsed ${iio_framework} "s@Library/Frameworks@lib@"]
system "install_name_tool -change ${lib_iio_framework} ${iio_framework} ${app}"
ln -s ${non_dr_app} ${destroot}${prefix}/bin
}
post-destroot {
# move Python install to frameworks_dir for Python
set py_install_dir ${python_top_dir}/lib
xinstall -m 755 -d ${destroot}${py_install_dir}
move ${destroot}${prefix}/lib/${python_name} ${destroot}${py_install_dir}

# link from iio.framework to normal
set iio_framework_version ${version}
set iio_framework_top ${frameworks_dir}/iio.framework
set iio_framework ${iio_framework_top}/Versions/${iio_framework_version}/iio
set iio_dr_framework_top ${destroot}${iio_framework_top}

# fix iio library & link it into .../lib
xinstall -m 755 -d ${destroot}${prefix}/lib
ln -s ${iio_framework_top}/Versions/${iio_framework_version}/iio ${destroot}${prefix}/lib/libiio.dylib
system "install_name_tool -id ${iio_framework} ${destroot}${iio_framework}"

# fix Tools, and link them into .../bin
xinstall -m 755 -d ${destroot}${prefix}/bin
foreach app [glob ${iio_dr_framework_top}/Tools/*] {
set non_dr_app [strsed ${app} "s@${destroot}@@"]
set lib_iio_framework [strsed ${iio_framework} "s@Library/Frameworks@lib@"]
system "install_name_tool -change ${lib_iio_framework} ${iio_framework} ${app}"
ln -s ${non_dr_app} ${destroot}${prefix}/bin
}

# link includes into .../include
xinstall -m 755 -d ${destroot}${prefix}/include
foreach header [glob ${iio_dr_framework_top}/Versions/${iio_framework_version}/Headers/*] {
ln -s [strsed ${header} "s@${destroot}@@"] ${destroot}${prefix}/include
# link includes into .../include
xinstall -m 755 -d ${destroot}${prefix}/include
foreach header [glob ${iio_dr_framework_top}/Versions/${iio_framework_version}/Headers/*] {
ln -s [strsed ${header} "s@${destroot}@@"] ${destroot}${prefix}/include
}
}
}

This file was deleted.

0 comments on commit 5448a39

Please sign in to comment.
You can’t perform that action at this time.