-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pg_dump, pg_dumpall, pg_restore 14.2 (#20)
postgresql-client static build
- Loading branch information
Showing
5 changed files
with
240 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: pg_dump | ||
|
||
on: [pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
prejob: | ||
uses: ./.github/workflows/set-output-workflow.yml | ||
with: | ||
workflow: ${{ github.workflow }} | ||
secrets: | ||
_WORKFLOW: ${{ secrets._CURRENT_TOOL }} | ||
|
||
alpine-musl: | ||
needs: prejob | ||
if: ${{ needs.prejob.outputs.workflow == github.workflow }} | ||
uses: ./.github/workflows/build-alpine.yml | ||
with: | ||
workflow: ${{ github.workflow }} | ||
|
||
alpine-mingw: | ||
needs: prejob | ||
if: ${{ needs.prejob.outputs.workflow == github.workflow }} | ||
uses: ./.github/workflows/build-alpine.yml | ||
with: | ||
workflow: ${{ github.workflow }} | ||
toolset: mingw | ||
|
||
ubuntu-glibc-test: | ||
needs: alpine-musl | ||
if: ${{ needs.prejob.outputs.workflow == github.workflow }} | ||
uses: ./.github/workflows/test-ubuntu.yml | ||
with: | ||
artifact: build-musl | ||
test-run: | | ||
./${{ github.workflow }} --version | ||
windows-mingw-test: | ||
needs: alpine-mingw | ||
if: ${{ needs.prejob.outputs.workflow == github.workflow }} | ||
uses: ./.github/workflows/test-windows.yml | ||
with: | ||
artifact: build-mingw | ||
test-run: | | ||
./${{ github.workflow }} --version | ||
release: | ||
needs: [ubuntu-glibc-test, | ||
windows-mingw-test] | ||
uses: ./.github/workflows/release.yml | ||
with: | ||
workflow: ${{ github.workflow }} | ||
tool_version: '14.2' | ||
prepare_body: | | ||
bsdtar -Oxf ./build-musl/build-musl.tar.gz build-musl.md >> body.md | ||
bsdtar -Oxf ./build-mingw/build-mingw.tar.gz build-mingw.md >> body.md | ||
artifacts: ./build-musl/build-musl.tar.gz,./build-mingw/build-mingw.tar.gz | ||
secrets: | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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,53 @@ | ||
#!/bin/bash | ||
dp0="$(realpath "$(dirname "$0")")" | ||
set -e | ||
|
||
echo "::group::install deps" | ||
|
||
apk update | ||
apk add --no-cache alpine-sdk linux-headers zlib-dev zlib-static postgresql-dev perl-dev bison flex mingw-w64-gcc icu-dev | ||
|
||
echo "::endgroup::" | ||
|
||
tool_name="pg_dump.exe" | ||
tool_version="REL_14_2" | ||
echo "::set-output name=tool_name::$tool_name" | ||
echo "::set-output name=tool_version::$tool_version" | ||
|
||
download_url="https://github.com/postgres/postgres/archive/refs/tags/$tool_version.tar.gz" | ||
echo "::group::prepare sources $download_url" | ||
|
||
tool_root_path="$dp0/release/postgres-$tool_version" | ||
|
||
mkdir -p "$dp0/release/build" && cd "$dp0/release" | ||
|
||
if [[ ! -f "$tool_root_path/configure" ]]; then | ||
wget "$download_url" -O "tool-$tool_version.tar.gz" && tar -xf "tool-$tool_version.tar.gz" | ||
fi | ||
|
||
cd "$tool_root_path" | ||
|
||
echo "::endgroup::" | ||
|
||
echo "::group::build" | ||
|
||
./configure --without-readline --without-zlib --with-system-tzdata=/usr/share/zoneinfo --host=x86_64-w64-mingw32 | ||
make -j$(nproc) | ||
|
||
echo "::endgroup::" | ||
|
||
cp "$tool_root_path/src/bin/pg_dump/pg_dump.exe" "$dp0/release/build/" | ||
cp "$tool_root_path/src/bin/pg_dump/pg_dumpall.exe" "$dp0/release/build/" | ||
cp "$tool_root_path/src/bin/pg_dump/pg_restore.exe" "$dp0/release/build/" | ||
cp "$tool_root_path/src/interfaces/libpq/libpq.dll" "$dp0/release/build/" | ||
|
||
cd "$dp0/release/build" | ||
|
||
{ printf 'SHA-256: %s | ||
%s | ||
' "$(sha256sum $tool_name)" "$download_url" | ||
} > build-mingw.md | ||
|
||
cat build-mingw.md | ||
|
||
tar -czvf ../build-mingw.tar.gz . |
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,63 @@ | ||
#!/bin/bash | ||
dp0="$(realpath "$(dirname "$0")")" | ||
set -e | ||
|
||
echo "::group::install deps" | ||
|
||
apk update | ||
apk add --no-cache alpine-sdk linux-headers zlib-dev zlib-static postgresql-dev perl-dev bison flex libpq-dev | ||
|
||
echo "::endgroup::" | ||
|
||
tool_name="pg_dump" | ||
tool_version="REL_14_2" | ||
echo "::set-output name=tool_name::$tool_name" | ||
echo "::set-output name=tool_version::$tool_version" | ||
|
||
download_url="https://github.com/postgres/postgres/archive/refs/tags/$tool_version.tar.gz" | ||
echo "::group::prepare sources $download_url" | ||
|
||
tool_root_path="$dp0/release/postgres-$tool_version" | ||
|
||
mkdir -p "$dp0/release/build" && cd "$dp0/release" | ||
|
||
if [[ ! -f "$tool_root_path/configure" ]]; then | ||
wget "$download_url" -O "tool-$tool_version.tar.gz" && tar -xf "tool-$tool_version.tar.gz" | ||
fi | ||
|
||
cp "$dp0/release/Makefile" "$tool_root_path/src/bin/pg_dump/" | ||
|
||
cd "$tool_root_path" | ||
|
||
echo "::endgroup::" | ||
|
||
echo "::group::build" | ||
|
||
./configure --without-readline --without-zlib | ||
|
||
make -j$(nproc) | ||
|
||
echo "::endgroup::" | ||
|
||
cp "$tool_root_path/src/bin/pg_dump/pg_dump" "$dp0/release/build/" | ||
cp "$tool_root_path/src/bin/pg_dump/pg_dumpall" "$dp0/release/build/" | ||
cp "$tool_root_path/src/bin/pg_dump/pg_restore" "$dp0/release/build/" | ||
|
||
cd "$dp0/release/build" | ||
|
||
strip "$tool_name" | ||
strip "pg_dumpall" | ||
strip "pg_restore" | ||
|
||
chmod +x "$tool_name" | ||
chmod +x "pg_dumpall" | ||
chmod +x "pg_restore" | ||
|
||
{ printf 'SHA-256: %s | ||
%s | ||
' "$(sha256sum $tool_name)" "$("./$tool_name" --version)" | ||
} > build-musl.md | ||
|
||
cat build-musl.md | ||
|
||
tar -czvf ../build-musl.tar.gz . |
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,65 @@ | ||
#------------------------------------------------------------------------- | ||
# | ||
# Makefile for src/bin/pg_dump | ||
# | ||
# Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group | ||
# Portions Copyright (c) 1994, Regents of the University of California | ||
# | ||
# src/bin/pg_dump/Makefile | ||
# | ||
#------------------------------------------------------------------------- | ||
|
||
PGFILEDESC = "pg_dump/pg_restore/pg_dumpall - backup and restore PostgreSQL databases" | ||
PGAPPICON=win32 | ||
|
||
subdir = src/bin/pg_dump | ||
top_builddir = ../../.. | ||
include $(top_builddir)/src/Makefile.global | ||
|
||
override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) | ||
LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport) -static | ||
|
||
OBJS = \ | ||
$(WIN32RES) \ | ||
compress_io.o \ | ||
dumputils.o \ | ||
parallel.o \ | ||
pg_backup_archiver.o \ | ||
pg_backup_custom.o \ | ||
pg_backup_db.o \ | ||
pg_backup_directory.o \ | ||
pg_backup_null.o \ | ||
pg_backup_tar.o \ | ||
pg_backup_utils.o | ||
|
||
all: pg_dump pg_restore pg_dumpall | ||
|
||
pg_dump: pg_dump.o common.o pg_dump_sort.o $(OBJS) | submake-libpq submake-libpgport submake-libpgfeutils | ||
$(CC) $(CFLAGS) pg_dump.o common.o pg_dump_sort.o $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X) | ||
|
||
pg_restore: pg_restore.o $(OBJS) | submake-libpq submake-libpgport submake-libpgfeutils | ||
$(CC) $(CFLAGS) pg_restore.o $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X) | ||
|
||
pg_dumpall: pg_dumpall.o dumputils.o | submake-libpq submake-libpgport submake-libpgfeutils | ||
$(CC) $(CFLAGS) pg_dumpall.o dumputils.o $(WIN32RES) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X) | ||
|
||
install: all installdirs | ||
$(INSTALL_PROGRAM) pg_dump$(X) '$(DESTDIR)$(bindir)'/pg_dump$(X) | ||
$(INSTALL_PROGRAM) pg_restore$(X) '$(DESTDIR)$(bindir)'/pg_restore$(X) | ||
$(INSTALL_PROGRAM) pg_dumpall$(X) '$(DESTDIR)$(bindir)'/pg_dumpall$(X) | ||
|
||
installdirs: | ||
$(MKDIR_P) '$(DESTDIR)$(bindir)' | ||
|
||
check: | ||
$(prove_check) | ||
|
||
installcheck: | ||
$(prove_installcheck) | ||
|
||
uninstall: | ||
rm -f $(addprefix '$(DESTDIR)$(bindir)'/, pg_dump$(X) pg_restore$(X) pg_dumpall$(X)) | ||
|
||
clean distclean maintainer-clean: | ||
rm -f pg_dump$(X) pg_restore$(X) pg_dumpall$(X) $(OBJS) pg_dump.o common.o pg_dump_sort.o pg_restore.o pg_dumpall.o | ||
rm -rf tmp_check |