Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-5282: Adding linux_arm_64 and mac_arm_64 support to make-postgres.sh

Ryan Kurtz483dee2889a2
diff --git a/Ghidra/Features/BSim/support/make-postgres.sh b/Ghidra/Features/BSim/support/make-postgres.sh
index d0b0af2d95..dd33ea2ef9 100755
--- a/Ghidra/Features/BSim/support/make-postgres.sh
+++ b/Ghidra/Features/BSim/support/make-postgres.sh
@@ -55,10 +55,13 @@ echo $DIR
POSTGRES_GZ_PATH=${DIR}/../../../../ghidra.bin/Ghidra/Features/BSim/${POSTGRES_GZ}
if [ ! -f "${POSTGRES_GZ_PATH}" ]; then
- POSTGRES_GZ_PATH=${DIR}/support/${POSTGRES_GZ}
+ POSTGRES_GZ_PATH=${DIR}/../../../dependencies/BSim/${POSTGRES_GZ}
if [ ! -f "${POSTGRES_GZ_PATH}" ]; then
- echo "Postgres source bundle not found: ${POSTGRES_GZ_PATH}"
- exit -1
+ POSTGRES_GZ_PATH=${DIR}/support/${POSTGRES_GZ}
+ if [ ! -f "${POSTGRES_GZ_PATH}" ]; then
+ echo "Postgres source bundle not found: ${POSTGRES_GZ_PATH}"
+ exit -1
+ fi
fi
fi
@@ -81,15 +84,27 @@ pushd build/${POSTGRES}
if [ "$OS" = "Darwin" ]; then
export MACOSX_DEPLOYMENT_TARGET=10.5
- export ARCHFLAGS="-arch x86_64"
- OSDIR=mac_x86_64
+ export ARCHFLAGS="-arch $ARCH"
+ if [ "$ARCH" = "x86_64" ]; then
+ OSDIR="mac_x86_64"
+ HOMEBREW="/usr/local"
+ else
+ OSDIR="mac_arm_64"
+ HOMEBREW="/opt/homebrew"
+ fi
+ POSTGRES_CONFIG_OPTIONS+="--with-includes=${HOMEBREW}/include"
+ POSTGRES_CONFIG_OPTIONS+="--with-libraries=${HOMEBREW}/lib"
elif [ "$ARCH" = "x86_64" ]; then
- OSDIR=linux_x86_64
+ OSDIR="linux_x86_64"
+elif [ "$ARCH" = "aarch64" ]; then
+ OSDIR="linux_arm_64"
else
echo "Unsupported platform: $OS $ARCH"
exit -1
fi
+echo "Platform: $OSDIR"
+
# Install within build/os
INSTALL_DIR=${DIR}/build/os/${OSDIR}/postgresql
rm -rf ${INSTALL_DIR} > /dev/null
diff --git a/GhidraDocs/GhidraClass/BSim/BSimTutorial_Ghidra_Command_Line.md b/GhidraDocs/GhidraClass/BSim/BSimTutorial_Ghidra_Command_Line.md
index 9d26802148..34494e4f36 100644
--- a/GhidraDocs/GhidraClass/BSim/BSimTutorial_Ghidra_Command_Line.md
+++ b/GhidraDocs/GhidraClass/BSim/BSimTutorial_Ghidra_Command_Line.md
@@ -8,7 +8,7 @@ So we can just build PostgreSQL and harvest the object files we need.
**Note**: For the tutorial, we continue to use the H2 BSim backend.
We do not run any PostgreSQL code, we simply analyze some files produced when building PostgreSQL.
-Note that these files must be built on a machine running Linux.
+Note that these files must be built on a machine running Linux or macOS.
Windows users can build these files in a Linux virtual machine.
To build the files, execute the following commands in a shell: [^1]