From 523211d70810ce2bc15c3fc5fed3bbaf5b4fa1d7 Mon Sep 17 00:00:00 2001
From: Samay Sharma <smilingsamay@gmail.com>
Date: Fri, 24 Feb 2023 20:41:28 -0800
Subject: [PATCH v8 5/5] Change Short Version for meson installation guide

This commit proposes a new version of the short version for building
from source using meson. Some advantages over the current version
include: does not require sudo, creates a localised installation
path and doesn't replace system binaries, doesn't have distro specific
commands and has one line description of what each command does.
---
 doc/src/sgml/installation.sgml | 40 +++++++++++++++++++++++++---------
 1 file changed, 30 insertions(+), 10 deletions(-)

diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 140b1f518f..0b87f320f5 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -1983,19 +1983,39 @@ build-postgresql:
 
   <para>
 <synopsis>
-meson setup build --prefix=/usr/local/pgsql
+# create working directory
+mkdir postgres
+cd postgres
+
+# fetch source code
+git clone https://git.postgresql.org/git/postgresql.git src
+
+# setup and enter build directory (done only first time)
+## Unix based platforms
+meson setup build src --prefix=$PWD/install
+
+## Windows
+meson setup build src --prefix=%cd%/install
+
 cd build
+
+# Compile source
 ninja
-su
+
+# Install to the prefix directory specified above
 ninja install
-adduser postgres
-mkdir -p /usr/local/pgsql/data
-chown postgres /usr/local/pgsql/data
-su - postgres
-/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
-/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
-/usr/local/pgsql/bin/createdb test
-/usr/local/pgsql/bin/psql test
+
+# Run all tests (optional, takes time)
+meson test
+
+# Initialize a new database
+../install/bin/initdb -D ../data
+
+# Start database
+../install/bin/pg_ctl -D ../data/ -l logfile start
+
+# Connect to the database
+../install/bin/psql -d postgres
 </synopsis>
    The long version is the rest of this
    <phrase>section</phrase>.
-- 
2.38.1

