Ticket #62354: install-or-update-macports.sh

File install-or-update-macports.sh, 2.4 KB (added by jeremyhu (Jeremy Huddleston Sequoia), 2 years ago)

install-or-update-macports.sh

Line 
1BUILD_TOOLS_PREFIX="/opt/buildX11"
2
3# presently hard-coded to base branch "release-2.6"
4# MACPORTS_VERSION="2.6"
5
6die() {
7    echo "${@}" >&2
8    exit 1
9}
10
11if ! [ -f "${BUILD_TOOLS_PREFIX}/bin/port" ] ; then
12    cd /tmp || die "Could not change to tmp directory"
13
14    if [ -d "/tmp/macports-base" ] ; then
15        sudo rm -rf /tmp/macports-base || die "Could not remove /tmp/macports-base"
16    fi
17
18    git clone -b release-2.6 https://github.com/macports/macports-base.git || die "Could not clone macports-base"
19    cd macports-base || die "Could not enter macports-base"
20    ./configure --prefix="${BUILD_TOOLS_PREFIX}" --with-applications-dir="${BUILD_TOOLS_PREFIX}/Applications" --without-startupitems || die "Could not configure macports"
21    make -j$(sysctl -n hw.activecpu) || die "macports-base build failed"
22    sudo make install || die "macports-base install failed into ${BUILD_TOOLS_PREFIX}"
23fi
24
25if ! [ -f "${BUILD_TOOLS_PREFIX}/bin/port" ] ; then
26    die "MacPorts should be installed now, but ${BUILD_TOOLS_PREFIX}/bin/port not found"
27fi
28
29if [ -d "${BUILD_TOOLS_PREFIX}/lib/pkgconfig-stored" ] ; then
30    sudo mv -f ${BUILD_TOOLS_PREFIX}/lib/pkgconfig-stored ${BUILD_TOOLS_PREFIX}/lib/pkgconfig || die "Could not move ${BUILD_TOOLS_PREFIX}/lib/pkgconfig-stored back into position"
31fi
32
33if [ -d "${BUILD_TOOLS_PREFIX}/share/pkgconfig-stored" ] ; then
34    sudo mv -f ${BUILD_TOOLS_PREFIX}/share/pkgconfig-stored ${BUILD_TOOLS_PREFIX}/share/pkgconfig || die "Could not move ${BUILD_TOOLS_PREFIX}/share/pkgconfig-stored back into position"
35fi
36
37sudo ${BUILD_TOOLS_PREFIX}/bin/port -v selfupdate || die "Could not selfupdate macports"
38sudo ${BUILD_TOOLS_PREFIX}/bin/port -N -v install autoconf automake pkgconfig libtool py39-mako meson xmlto asciidoc doxygen fop groff docbook-utils || die "Could not install basic toolchain"
39sudo ${BUILD_TOOLS_PREFIX}/bin/port select python3 python39 || die "Could not select python3"
40
41if [ -d "${BUILD_TOOLS_PREFIX}/lib/pkgconfig" ] ; then
42    sudo mv -f ${BUILD_TOOLS_PREFIX}/lib/pkgconfig ${BUILD_TOOLS_PREFIX}/lib/pkgconfig-stored || die "Could not move ${BUILD_TOOLS_PREFIX}/lib/pkgconfig to stored"
43fi
44
45if [ -d "${BUILD_TOOLS_PREFIX}/share/pkgconfig" ] ; then
46    sudo mv -f ${BUILD_TOOLS_PREFIX}/share/pkgconfig ${BUILD_TOOLS_PREFIX}/share/pkgconfig-stored || die "Could not move ${BUILD_TOOLS_PREFIX}/share/pkgconfig to stored"
47fi
48
49echo "MacPorts toolchain successfully installed in ${BUILD_TOOLS_PREFIX}"
50