Skip to content

Commit

Permalink
add: pkg-config wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
uyjulian committed Dec 14, 2024
1 parent fa8d296 commit 0ab080f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions Defs.make
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ EE_OBJCOPY ?= $(EE_TOOL_PREFIX)objcopy
EE_STRIP ?= $(EE_TOOL_PREFIX)strip
EE_ADDR2LINE ?= $(EE_TOOL_PREFIX)addr2line
EE_RANLIB ?= $(EE_TOOL_PREFIX)ranlib
EE_PKG_CONFIG ?= $(EE_TOOL_PREFIX)pkg-config

#
# Defintions for the IOP toolchain.
Expand Down
4 changes: 3 additions & 1 deletion samples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.

BIN_TARGET = $(PS2SDK)/bin
SAMPLES_TARGET = $(PS2SDK)/samples
SHARE_TARGET = $(PS2DEV)/share

Expand All @@ -28,7 +29,8 @@ release-samples:
cp -f Makefile.eeglobal_cpp_sample $(SAMPLES_TARGET)/Makefile.eeglobal_cpp
cp -f Makefile.iopglobal_sample $(SAMPLES_TARGET)/Makefile.iopglobal
cp -f ps2dev.cmake $(SHARE_TARGET)/ps2dev.cmake
cp -f ps2dev_iop.cmake $(SHARE_TARGET)/ps2dev_iop.cmake
cp -f pkg-config.in $(BIN_TARGET)/$(EE_TOOL_PREFIX)pkg-config
chmod 755 $(BIN_TARGET)/$(EE_TOOL_PREFIX)pkg-config

release-clean:
rm -f -r $(SAMPLES_TARGET)
Expand Down
14 changes: 14 additions & 0 deletions samples/pkg-config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env sh

command -v pkg-config >/dev/null 2>&1 || { printf >&2 "pkg-config is not found\n"; exit 1; }

# Ensure host libraries are not being used

export PKG_CONFIG_DIR=
export PKG_CONFIG_PATH=
export PKG_CONFIG_SYSROOT_DIR=

export PKG_CONFIG_LIBDIR=${PS2SDK}/ports/lib/pkgconfig:${PS2DEV}/gsKit/lib/pkgconfig:${PS2SDK}/ee/lib/pkgconfig

test "$1" = '--version' && exec pkg-config "$@"
exec pkg-config --static "$@"
5 changes: 5 additions & 0 deletions samples/ps2dev.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ SET(CMAKE_EXE_LINKER_FLAGS_INIT ${EE_LDFLAGS})

SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostartfiles -Wl,-r -Wl,-d")

find_program(PKG_CONFIG_EXECUTABLE NAMES mips64r5900el-ps2-elf-pkg-config HINTS "$ENV{PS2SDK}/bin")
if (NOT PKG_CONFIG_EXECUTABLE)
message(FATAL_ERROR "Could not find mips64r5900el-ps2-elf-pkg-config")
endif()

SET(PS2 TRUE)
SET(PLATFORM_PS2 TRUE)
SET(EE TRUE)

0 comments on commit 0ab080f

Please sign in to comment.