Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vcpkg, libpq] separate static and shared library installations #13491

Merged
merged 2 commits into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ports/libpq/CONTROL
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Source: libpq
Version: 12.2
Port-Version: 6
Port-Version: 7
Build-Depends: libpq[bonjour] (osx)
Supports: !uwp
Homepage: https://www.postgresql.org/
Expand Down
34 changes: 34 additions & 0 deletions ports/libpq/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
subdir = .
top_builddir = .
include src/Makefile.global

.NOTPARALLEL:

ifeq ($(LIBPQ_LIBRARY_TYPE), shared)
LIBPQ_LIB_SUFFIX = _shlib
endif

ifeq ($(LIBPQ_LIBRARY_TYPE), static)
LIBPQ_INSTALL_LIBS = install-stlib
endif

.PHONY: all
all:
$(MAKE) -C src/include MAKELEVEL=0
$(MAKE) -C src/common MAKELEVEL=0 libpgcommon$(LIBPQ_LIB_SUFFIX).a
$(MAKE) -C src/port MAKELEVEL=0 libpgport$(LIBPQ_LIB_SUFFIX).a
$(MAKE) -C src/interfaces/libpq MAKELEVEL=0 all-$(LIBPQ_LIBRARY_TYPE)-lib
$(MAKE) -C src/bin/pg_config MAKELEVEL=0

.PHONY: install-stlib
install-stlib:
$(MAKE) -C src/common MAKELEVEL=0 install -o all
rm -f '$(DESTDIR)$(libdir)/libpgcommon_shlib.a'
$(MAKE) -C src/port MAKELEVEL=0 install -o all
rm -f '$(DESTDIR)$(libdir)/libpgport_shlib.a'

.PHONY: install
install: $(LIBPQ_INSTALL_LIBS)
$(MAKE) -C src/include MAKELEVEL=0 install
$(MAKE) -C src/interfaces/libpq MAKELEVEL=0 install-lib-$(LIBPQ_LIBRARY_TYPE) install-lib-pc install -o all -o install-lib
$(MAKE) -C src/bin/pg_config MAKELEVEL=0 install
10 changes: 7 additions & 3 deletions ports/libpq/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ if(VCPKG_TARGET_IS_WINDOWS)

message(STATUS "Cleanup libpq ${TARGET_TRIPLET}... - done")
else()
file(COPY ${CMAKE_CURRENT_LIST_DIR}/Makefile DESTINATION ${SOURCE_PATH})

if("${FEATURES}" MATCHES "openssl")
list(APPEND BUILD_OPTS --with-openssl)
endif()
Expand All @@ -274,11 +276,13 @@ else()
--enable-debug
)

if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(ENV{LIBPQ_LIBRARY_TYPE} shared)
else()
set(ENV{LIBPQ_LIBRARY_TYPE} static)
endif()
vcpkg_install_make()

# instead?
# make -C src/include install
# make -C src/interfaces install
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
Expand Down
2 changes: 1 addition & 1 deletion scripts/cmake/vcpkg_build_make.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function(vcpkg_build_make)
# Set make command and install command
set(MAKE_OPTS ${_bc_MAKE_OPTIONS} V=1 -j ${VCPKG_CONCURRENCY} -f Makefile ${_bc_BUILD_TARGET})
set(NO_PARALLEL_MAKE_OPTS ${_bc_MAKE_OPTIONS} V=1 -j 1 -f Makefile ${_bc_BUILD_TARGET})
set(INSTALL_OPTS -j ${VCPKG_CONCURRENCY} install DESTDIR=${CURRENT_PACKAGES_DIR})
set(INSTALL_OPTS -j ${VCPKG_CONCURRENCY} -f Makefile install DESTDIR=${CURRENT_PACKAGES_DIR})
endif()

# Since includes are buildtype independent those are setup by vcpkg_configure_make
Expand Down