[MacPorts] #62580: swig fails test suite on Lion
MacPorts
noreply at macports.org
Sun Mar 28 22:04:16 UTC 2021
#62580: swig fails test suite on Lion
-------------------------------+-------------------------
Reporter: RobK88 | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.6.4
Resolution: | Keywords: Lion Hamlib
Port: swig swig-python |
-------------------------------+-------------------------
Comment (by kencu):
the likely problem is that MacPorts has put the software you need in
{{{/opt/local/}}}, but no compilers will look there by default. They look
instead in {{{/usr/local}}} and then {{{/usr}}}.
So this is both the greatest and the worst thing about MacPorts, and it is
why homebrew became popular in the first place I believe. Homebrew puts
symlinks to most everything it installs into {{{/usr/local}}}, so things
like what you are trying to do "just work". The downside is that these
installed files are used whether you want them to be or not, which can
cause troubles.
The easiest way out of this situation for the long term is to take a
couple of minutes to learn how to modify Portfiles for your own use. It
sounds like what you want to do is add a configuration argument to the
hamlib that MacPorts already installs, that add this {{{--with-python-
binding}}}.
So I am going to start by saying I don't know much about python or swig or
hamlib. But I can usually make MacPorts run backflips. So I will show you
how to do this. This will be long for clarity, but in actual use, takes me
no more than a minute to really do.
I see there are several packages available on MacPorts related to swig and
python, so I installed these, as I assume this should cover the needs:
{{{
$ port -v installed | grep swig
swig @4.0.2_1 (active) platform='darwin 11' archs='x86_64'
date='2021-01-17T08:51:38-0800'
swig-python @4.0.2_1 (active) platform='darwin 11' archs='x86_64'
date='2021-01-17T08:51:40-0800'
swig3 @3.0.12_2 (active) platform='darwin 11' archs='x86_64'
date='2021-01-17T08:51:37-0800'
swig3-python @3.0.12_2 (active) platform='darwin 11' archs='x86_64'
date='2021-01-17T08:51:40-0800'
}}}
Then we are going to modify the hamlib Portfile. First get rid of any
hamlib you have intalled:
{{{
sudo port -f uninstall hamlib
}}}
and clean up any leftover remnants:
{{{
sudo port clean hamlib
}}}
now let's modify it. First we need to find it:
{{{
$ port file hamlib
/opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/science/hamlib/Portfile
}}}
For this simple one, we will edit in place.
{{{
bbedit
/opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/science/hamlib/Portfile
}}}
and we see there are two hamlib subports, hamlib, and a devel version. We
will work on the hamlib port, which is the one below the "else". We are
going to take this part:
{{{
} else {
github.setup Hamlib Hamlib 4.1
github.tarball_from releases
checksums rmd160 fd5e2c165c02de0b60a6af1ff812cb12dbc64de7 \
sha256
b4d4b9467104d1f316c044d002c4c8e62b9f792cbb55558073bd963203b32342 \
size 2260629
revision 0
conflicts hamlib-devel
}
}}}
and add your desired arguments like this:
{{{
} else {
github.setup Hamlib Hamlib 4.1
github.tarball_from releases
checksums rmd160 fd5e2c165c02de0b60a6af1ff812cb12dbc64de7 \
sha256
b4d4b9467104d1f316c044d002c4c8e62b9f792cbb55558073bd963203b32342 \
size 2260629
revision 0
configure.args-append --with-python-binding
conflicts hamlib-devel
}
}}}
We then do:
{{{
sudo port -v build hamlib
}}}
and watching the build, everything looks good:
{{{
Hamlib Version 4.1 configuration:
Prefix /opt/local
Preprocessor /usr/bin/clang -E -I/opt/local/include
-I/opt/local/include/LegacySupport
C Compiler /usr/bin/clang -pipe -Os
-I/opt/local/include/LegacySupport -arch x86_64
C++ Compiler /usr/bin/clang++ -pipe -Os -stdlib=libc++ -arch x86_64
Package features:
With C++ binding no
With Perl binding no
With Python binding yes
...
}}}
everything links without any errors (MacPorts has told the compiler where
to find all the libraries).
And as it turns out, that is all you need to do to get what you want.
{{{
$ port contents hamlib | grep py
/opt/local/lib/python2.7/site-packages/Hamlib.py
/opt/local/lib/python2.7/site-packages/Hamlib.pyc
/opt/local/lib/python2.7/site-packages/Hamlib.pyo
/opt/local/lib/python2.7/site-packages/_Hamlib.a
/opt/local/lib/python2.7/site-packages/_Hamlib.la
/opt/local/lib/python2.7/site-packages/_Hamlib.so
/opt/local/share/doc/hamlib/examples/pytest.py
}}}
Then you test it, make sure it works.
Then for bonus points, you figure out exactly which of those swig bits you
needed, add them to the build as "depends_lib-append", and generate a new
variant perhaps, and then a PR.
--
Ticket URL: <https://trac.macports.org/ticket/62580#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list