1 | BUILD_TOOLS_PREFIX="/opt/buildX11" |
---|
2 | |
---|
3 | # presently hard-coded to base branch "release-2.6" |
---|
4 | # MACPORTS_VERSION="2.6" |
---|
5 | |
---|
6 | die() { |
---|
7 | echo "${@}" >&2 |
---|
8 | exit 1 |
---|
9 | } |
---|
10 | |
---|
11 | if ! [ -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}" |
---|
23 | fi |
---|
24 | |
---|
25 | if ! [ -f "${BUILD_TOOLS_PREFIX}/bin/port" ] ; then |
---|
26 | die "MacPorts should be installed now, but ${BUILD_TOOLS_PREFIX}/bin/port not found" |
---|
27 | fi |
---|
28 | |
---|
29 | if [ -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" |
---|
31 | fi |
---|
32 | |
---|
33 | if [ -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" |
---|
35 | fi |
---|
36 | |
---|
37 | sudo ${BUILD_TOOLS_PREFIX}/bin/port -v selfupdate || die "Could not selfupdate macports" |
---|
38 | sudo ${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" |
---|
39 | sudo ${BUILD_TOOLS_PREFIX}/bin/port select python3 python39 || die "Could not select python3" |
---|
40 | |
---|
41 | if [ -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" |
---|
43 | fi |
---|
44 | |
---|
45 | if [ -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" |
---|
47 | fi |
---|
48 | |
---|
49 | echo "MacPorts toolchain successfully installed in ${BUILD_TOOLS_PREFIX}" |
---|
50 | |
---|