I thought I would start up a short thread on progress with this -- MacPorts on Linux. We've long written the Portfiles with this in mind. This was done on an Intel system, with the current Ubuntu 20.04. Ubuntu 19.10 can be installed in a VM in parallels, and no doubt in other VM systems.

Some quick notes:

apt is the built-in package manager, similar to "port".

"sudo apt install" is the same as "sudo port install".

"apt info" is "port info"

"apt-file show" does something similar to "port contents", but the software does not have to be installed.


After downloading the MacPorts source tarball, and prior to building MacPorts, you must install the supporting software that comes already on Macs that MacPorts expects to find.

These were installed as:

sudo apt install mtree-netbsd
sudo apt install tcl8.6
sudo apt install curl
sudo apt install sqlite3
sudo apt install gnustep
sudo apt install libcurl4-gnutls-dev
sudo apt install libsqlite3-dev


my system already had llvm-10 and clang-10 installed, and there was already a symlink "port" linking /usr/bin/clang to the selected clang binary, in this case clang-10.

Then build and install MacPorts as usual, into /opt/local

./configure && make && sudo make install


Add to your PATH as usual, but on Ubuntu, by editing ".bashrc", adding:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH


Adding that PATH to the sudo command is harder -- it doesn't pick it up from the above ".bashrc". You have add it to the sudoers command with:

sudo visudo

and then add it to the secure_path

Defaults secure_path="/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

There are some differences between Darwin and Ubuntu, and to work around some of these that are not already compensated for by MacPorts base, I did this:


edit macports.conf

sudo gedit /opt/local/etc/macports/macports.conf

and add:

buildmakejobs            2                  # or a more appropriate number for your processor count default_compilers      clang            # compiler selection is broken, this chooses /usr/bin/clang which works best with macport's portfiles cxx_stdlib                   libstdc++     # configure.cxx_stdlib seems broken, this fills in appropriate default


After that, darwin and ubuntu supply 'sed' in different locations, so rather than edit 200 Portfiles, you can do this:

sudo ln -s /bin/sed /usr/bin/sed


and then you're up and running. Ports will at least start to build. There are a number of hiccups, where the portfile logic does not allow a path where the platform is other than "darwin" -- e.g. libuv, but these are easy to spot and easy to fix if desired. Some things appear harder to fix, like "m4" which I have not yet sorted out.


And then you can play around. I don't know if MacPorts on Ubuntu (or any other flavour of Linux) will ever be popular, but you can at least get started.


Best,


Ken



Reply via email to