forked from dtinth/mosh-static
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add build steps for macOS arm64 and x86_64 platforms
- Loading branch information
1 parent
13e0cb2
commit 3f47511
Showing
4 changed files
with
180 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
protobuf_LIBS=$(l=libprotobuf.a; for i in /opt/local/lib /usr/local/lib; do if [ -f $i/$l ]; then echo $i/$l; fi; done) | ||
if [ -z "$protobuf_LIBS" ]; then echo "Can't find libprotobuf.a"; exit 1; fi | ||
export protobuf_LIBS | ||
if ! pkg-config --cflags protobuf > /dev/null 2>&1; then | ||
protobuf_CFLAGS=-I$(for i in /opt /usr; do d=$i/local/include; if [ -d $d/google/protobuf ]; then echo $d; fi; done) | ||
if [ "$protobuf_CFLAGS" = "-I" ]; then echo "Can't find protobuf includes"; exit 1; fi | ||
export protobuf_CFLAGS | ||
fi | ||
export CXXFLAGS=-std=gnu++17 | ||
# XXX This script abuses Configure's --prefix argument badly. It uses | ||
# it as a $DESTDIR, but --prefix can also affect paths in generated | ||
# objects. That is not *currently* a problem in mosh. | ||
# | ||
PREFIX="$(pwd)/prefix" | ||
HOST="x86_64-apple-macosx${MACOSX_DEPLOYMENT_TARGET}" | ||
ARCH_TRIPLES="x86_64-apple-macosx arm64-apple-macos" | ||
pushd ../mosh > /dev/null | ||
if [ ! -f configure ]; | ||
then | ||
echo "Running autogen." | ||
PATH=/opt/local/bin:$PATH ./autogen.sh | ||
fi | ||
# | ||
# Build archs one by one. | ||
# | ||
for triple in $ARCH_TRIPLES; do | ||
arch=$(echo $triple | cut -d- -f1) | ||
echo "Building for ${arch}..." | ||
prefix="${PREFIX}_${arch}" | ||
rm -rf "${prefix}" | ||
mkdir "${prefix}" | ||
if ./configure --prefix="${prefix}/local" --build="${triple}${MACOSX_DEPLOYMENT_TARGET}"\ | ||
--host="${HOST}" \ | ||
CC="cc -arch ${arch}" CPP="cc -arch ${arch} -E" CXX="c++ -arch ${arch}" \ | ||
TINFO_LIBS=-lncurses && | ||
make clean && | ||
make install -j8 V=1 && | ||
rm -f "${prefix}/etc" | ||
then | ||
mv "${prefix}/local/bin/mosh-client" "${prefix}/local/bin/mosh-client-darwin-${arch}" | ||
mv "${prefix}/local/bin/mosh-server" "${prefix}/local/bin/mosh-server-darwin-${arch}" | ||
BUILT_ARCHS="$BUILT_ARCHS $arch" | ||
fi | ||
done | ||
if [ -z "$BUILT_ARCHS" ]; then | ||
echo "No architectures built successfully" | ||
exit 1 | ||
fi | ||
popd > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
exec sudo /usr/local/bin/gtar.orig "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
sudo /opt/local/bin/port install protobuf-cpp +universal | ||
sudo /opt/local/bin/port install ncurses +universal | ||
sudo /opt/local/bin/port install pkgconfig | ||
sudo /opt/local/bin/port install autoconf automake |