Compare commits
No commits in common. "de8be87036871e3ea3c181df7e7d16a19b40daa3" and "85cfe6290c48756bd5f9427c27b74c757ca31fce" have entirely different histories.
de8be87036
...
85cfe6290c
55
Makefile
55
Makefile
|
|
@ -1,27 +1,16 @@
|
|||
# =====CONFIGURATION=====
|
||||
# Version of postgresql to compile libpq from
|
||||
PQ_VER ?= 11.12
|
||||
# OpenSSL version
|
||||
PQ_VER ?= 11.12
|
||||
SSL_VER ?= 1.1.1k
|
||||
# Dumb-init version
|
||||
DI_VER ?= 1.2.5
|
||||
|
||||
|
||||
# =====AUTO-GENERATED VARIABLES=====
|
||||
# This is such a lovely oneliner
|
||||
# NOTE: $(dir PATH) outputs a trailing slash
|
||||
OUT_DIR ?= $(dir $(abspath $(lastword $(MAKEFILE_LIST))))out
|
||||
OUT_DIR ?= $(dir $(abspath $(lastword $(MAKEFILE_LIST))))out/deps
|
||||
|
||||
PREFIX := $(OUT_DIR)/prefix
|
||||
# Generated variables for ease of use
|
||||
PREFIX := $(OUT_DIR)/prefix
|
||||
OPENSSL_DIR := $(OUT_DIR)/openssl-$(SSL_VER)
|
||||
PQ_DIR := $(OUT_DIR)/postgresql-$(PQ_VER)
|
||||
DI_DIR := $(OUT_DIR)/dumb-init-$(DI_VER)
|
||||
PQ_DIR := $(OUT_DIR)/postgresql-$(PQ_VER)
|
||||
CORES != nproc
|
||||
|
||||
# Used in various make calls to specify parallel recipes
|
||||
CORES != nproc
|
||||
|
||||
|
||||
# =====ENVIRONMENT VARIABLES=====
|
||||
export CC=musl-gcc -fPIC -pie -static
|
||||
export LD_LIBRARY_PATH=$(PREFIX)
|
||||
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
|
||||
|
|
@ -32,19 +21,8 @@ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
|
|||
# Create the out dir
|
||||
$(shell mkdir -p "$(PREFIX)")
|
||||
|
||||
|
||||
# ====RECIPES====
|
||||
all: openssl
|
||||
.PHONY: all
|
||||
all: build
|
||||
|
||||
# libpq builds openssl as a dependency
|
||||
.PHONY: build
|
||||
build: libpq
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@ echo "Note: this only cleans the C dependencies, not the Cargo cache."
|
||||
rm -rf "$(PQ_DIR)" "$(OPENSSL_DIR)" "$(DI_DIR)" "$(PREFIX)"
|
||||
|
||||
|
||||
# =====OPENSSL=====
|
||||
|
|
@ -61,11 +39,11 @@ $(OPENSSL_DIR)/Configure:
|
|||
linux-x86_64
|
||||
|
||||
# Build OpenSSL
|
||||
.PHONY: openssl
|
||||
openssl: $(OPENSSL_DIR)/Configure
|
||||
C_INCLUDE_PATH="$(PREFIX)/include" $(MAKE) -C "$(OPENSSL_DIR)" depend
|
||||
$(MAKE) -C "$(OPENSSL_DIR)" -j$(CORES)
|
||||
$(MAKE) -C "$(OPENSSL_DIR)" install_sw
|
||||
.PHONY: openssl
|
||||
|
||||
|
||||
# =====LIBPQ=====
|
||||
|
|
@ -76,25 +54,14 @@ $(PQ_DIR)/configure:
|
|||
cd "$(PQ_DIR)" && \
|
||||
LDFLAGS="-L$(PREFIX)/lib" CFLAGS="-I$(PREFIX)/include" ./configure \
|
||||
--without-readline \
|
||||
--with-openssl \
|
||||
--without-zlib \
|
||||
--with-openssl \
|
||||
--prefix="$(PREFIX)" \
|
||||
--host=x86_64-unknown-linux-musl
|
||||
|
||||
.PHONY: libpq
|
||||
libpq: openssl $(PQ_DIR)/configure
|
||||
libpq: $(PQ_DIR)/configure
|
||||
make -C "$(PQ_DIR)/src/interfaces/libpq" -j$(CORES) all-static-lib
|
||||
make -C "$(PQ_DIR)/src/interfaces/libpq" install install-lib-static
|
||||
make -C "$(PQ_DIR)/src/bin/pg_config" -j $(CORES)
|
||||
make -C "$(PQ_DIR)/src/bin/pg_config" install
|
||||
|
||||
|
||||
# =====DUMB-INIT=====
|
||||
# NOTE: this is only used inside the Docker image, but it's here for completeness.
|
||||
$(DI_DIR)/Makefile:
|
||||
curl -sSL "https://github.com/Yelp/dumb-init/archive/refs/tags/v$(DI_VER).tar.gz" | \
|
||||
tar -C "$(OUT_DIR)" -xz
|
||||
|
||||
.PHONY: dumb-init
|
||||
dumb-init: $(DI_DIR)/Makefile
|
||||
make -C "$(DI_DIR)" build
|
||||
.PHONY: libpq
|
||||
|
|
|
|||
Reference in New Issue