Skip to content

Commit

Permalink
make.sh: copy capstone.pc to the right dir for pkgconfig. adapted fro…
Browse files Browse the repository at this point in the history
…m patches of Ben Nagy & Pancake
  • Loading branch information
aquynh committed Apr 12, 2014
1 parent d65abd4 commit 217684f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ LIBOBJ += $(LIBOBJ_ARM) $(LIBOBJ_ARM64) $(LIBOBJ_MIPS) $(LIBOBJ_PPC) $(LIBOBJ_X8
LIBOBJ += MCInst.o


PKGCFGDIR = $(LIBDATADIR)/pkgconfig
PKGCFGDIR ?= $(LIBDATADIR)/pkgconfig
API_MAJOR=$(shell echo `grep -e CS_API_MAJOR include/capstone.h | grep -v = | awk '{print $$3}'` | awk '{print $$1}')
VERSION_EXT =

Expand Down
52 changes: 43 additions & 9 deletions make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,64 @@ function build {
}

function install {
if [ ${CC}x != x ]; then
${MAKE} CC=$CC install
# Mac OSX needs to find the right directory for pkgconfig
if [ "$(uname)" == "Darwin" ]; then
# find the directory automatically, so we can support both Macport & Brew
PKGCFGDIR="$(pkg-config --variable pc_path pkg-config | cut -d ':' -f 1)"
if [ ${PKGCFGDIR}x != x ]; then
if [ ${CC}x != x ]; then
${MAKE} CC=$CC PKGCFGDIR=$PKGCFGDIR install
else
${MAKE} PKGCFGDIR=$PKGCFGDIR install
fi
else
if [ ${CC}x != x ]; then
${MAKE} CC=$CC install
else
${MAKE} install
fi
fi
else
if [ ${CC}x != x ]; then
${MAKE} CC=$CC install
else
${MAKE} install
fi
fi
}

function uninstall {
# Mac OSX needs to find the right directory for pkgconfig
if [ "$(uname)" == "Darwin" ]; then
# find the directory automatically, so we can support both Macport & Brew
PKGCFGDIR="$(pkg-config --variable pc_path pkg-config | cut -d ':' -f 1)"
if [ ${PKGCFGDIR}x != x ]; then
${MAKE} PKGCFGDIR=$PKGCFGDIR uninstall
else
${MAKE} uninstall
fi
else
${MAKE} install
${MAKE} uninstall
fi
}

MAKE=make
if [ "$(uname)" == "SunOS" ]; then
export MAKE=gmake
export INSTALL_BIN=ginstall
export CC=gcc
export MAKE=gmake
export INSTALL_BIN=ginstall
export CC=gcc
fi

if [[ "$(uname)" == *BSD* ]]; then
export MAKE=gmake
export PREFIX=/usr/local
export MAKE=gmake
export PREFIX=/usr/local
fi

case "$1" in
"" ) build;;
"default" ) build;;
"install" ) install;;
"uninstall" ) ${MAKE} uninstall;;
"uninstall" ) uninstall;;
"nix32" ) CFLAGS=-m32 LDFLAGS=-m32 build;;
"cross-win32" ) CROSS=i686-w64-mingw32- build;;
"cross-win64" ) CROSS=x86_64-w64-mingw32- build;;
Expand Down

0 comments on commit 217684f

Please sign in to comment.