Skip to content

Commit e10a2ee

Browse files
committed
Add APR/APU pathes to LIBRARY_SEARCH_PATHS
... and add -L flags to pkgconfig
1 parent 089ab89 commit e10a2ee

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

xcconfig/config.make

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,36 @@ endif
8888
# APR and APU configs
8989

9090
ifeq ($(USE_APXS),yes)
91+
ifeq ($(APR_CONFIG),)
92+
APR_CONFIG = $(shell apxs -q APR_CONFIG)
93+
endif
94+
ifeq ($(APU_CONFIG),)
95+
APU_CONFIG = $(shell apxs -q APU_CONFIG)
96+
endif
97+
9198
PKGCONFIG_INCLUDE_DIRS += \
9299
$(shell apxs -q INCLUDEDIR) \
93100
$(shell apxs -q APR_INCLUDEDIR) \
94101
$(shell apxs -q APU_INCLUDEDIR)
102+
103+
104+
# There is no APR/APU_LIBDIR because Apache doesn't assume us to link to it
105+
# explicitly. But this is exactly what the module maps do (because clients
106+
# can also link that)
107+
108+
# We leave out this one, with Brew it doesn't exist and well, it doesn't
109+
# make much sense as we are not linking Apache.
110+
# PKGCONFIG_LIB_DIRS += $(shell apxs -q LIBDIR)
111+
112+
# this is a little fishy, but well
113+
ifneq ($(APR_CONFIG),)
114+
PKGCONFIG_LDFLAGS += $(shell $(APR_CONFIG) --link-ld)
115+
endif
116+
ifneq ($(APU_CONFIG),)
117+
PKGCONFIG_LDFLAGS += $(shell $(APU_CONFIG) --link-ld)
118+
endif
119+
PKGCONFIG_LIB_DIRS += \
120+
$(patsubst -L%,%,$(patsubst -l%,,$(PKGCONFIG_LDFLAGS)))
95121
endif
96122

97123

xcconfig/rules-apxs.make

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ PKGCONFIG_CFLAGS = \
103103
"-I\$${libdir}/swift/shims" \
104104
$(addprefix -I,$(PKGCONFIG_INCLUDE_DIRS))
105105

106+
# tbd
107+
PKGCONFIG_LDFLAGS_NO_LIBS = \
108+
$(addprefix -L,$(PKGCONFIG_LIB_DIRS))
109+
106110
# Also: libs. Not served by apxs which doesn't need libs, but we might still
107111
#. want to do those for apr/apu apps?
108112
$(PACKAGE_PKGCONFIG) : $(wildcard config.make)
@@ -114,6 +118,7 @@ $(PACKAGE_PKGCONFIG) : $(wildcard config.make)
114118
@echo "Description: $(PACKAGE_DESCRIPTION)" >> "$(PACKAGE_PKGCONFIG)"
115119
@echo "Version: $(PACKAGE_VERSION_STRING)" >> "$(PACKAGE_PKGCONFIG)"
116120
@echo "Cflags: $(PKGCONFIG_CFLAGS)" >> "$(PACKAGE_PKGCONFIG)"
121+
@echo "Libs: $(PKGCONFIG_LDFLAGS_NO_LIBS)" >> "$(PACKAGE_PKGCONFIG)"
117122

118123

119124
# xcconfig
@@ -137,7 +142,7 @@ $(PACKAGE_XCCONFIG) : $(wildcard config.make)
137142
@echo "EXECUTABLE_PREFIX = " >> "$(PACKAGE_XCCONFIG)"
138143
@echo "" >> "$(PACKAGE_XCCONFIG)"
139144
@echo "HEADER_SEARCH_PATHS = \$$(inherited) $(HEADER_FILES_INSTALL_DIR) $(PKGCONFIG_INCLUDE_DIRS)" >> "$(PACKAGE_XCCONFIG)"
140-
@echo "LIBRARY_SEARCH_PATHS = \$$(inherited) \$$(TOOLCHAIN_DIR)/usr/lib/swift/macosx \$$(BUILT_PRODUCTS_DIR)" >> "$(PACKAGE_XCCONFIG)"
145+
@echo "LIBRARY_SEARCH_PATHS = \$$(inherited) $(PKGCONFIG_LIB_DIRS) \$$(TOOLCHAIN_DIR)/usr/lib/swift/macosx \$$(BUILT_PRODUCTS_DIR)" >> "$(PACKAGE_XCCONFIG)"
141146
@echo "LD_RUNPATH_SEARCH_PATHS = \$$(inherited) \$$(TOOLCHAIN_DIR)/usr/lib/swift/macosx \$$(BUILT_PRODUCTS_DIR)" >> "$(PACKAGE_XCCONFIG)"
142147
@echo "" >> "$(PACKAGE_XCCONFIG)"
143148
@echo "OTHER_CFLAGS = \$$(inherited) $(shell $(APXS) -q EXTRA_CPPFLAGS)" >> "$(PACKAGE_XCCONFIG)"

0 commit comments

Comments
 (0)