Hash :
90d43dfb
Author :
Thomas de Grivel
Date :
2024-07-27T22:51:38
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
#!/bin/sh
## kc3
## Copyright 2022-2024 kmx.io <contact@kmx.io>
##
## Permission is hereby granted to use this software granted the above
## copyright notice and this permission paragraph are included in all
## copies and substantial portions of this software.
##
## THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
## PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
## THIS SOFTWARE.
set -e
echo "$PWD/configure"
export SRC_TOP="$(dirname "$PWD")"
CONFIG_H_PREFIX=LIBKC3_WINDOW_CAIRO_
. ../../config.subr
LIB=libkc3_window_cairo.la
LIB_ASAN=libkc3_window_cairo_asan.la
LIB_COV=libkc3_window_cairo_cov.la
LIB_DEBUG=libkc3_window_cairo_debug.la
echo "LIB = $LIB" >> ${CONFIG_MK}
echo "LIB_ASAN = $LIB_ASAN" >> ${CONFIG_MK}
echo "LIB_COV = $LIB_COV" >> ${CONFIG_MK}
echo "LIB_DEBUG = $LIB_DEBUG" >> ${CONFIG_MK}
. ./sources.sh
OBJECTS="$(c2ext .main.lo "$SOURCES")"
echo "OBJECTS = $OBJECTS" >> ${CONFIG_MK}
OBJECTS_ASAN="$(c2ext .asan.lo "$SOURCES")"
OBJECTS_COV="$(c2ext .cov.lo "$SOURCES")"
OBJECTS_DEBUG="$(c2ext .debug.lo "$SOURCES")"
# Common config for all targets
CPPFLAGS="-I../.. $CPPFLAGS"
OBJCFLAGS="$CFLAGS -W -Wall -Werror"
CFLAGS="$CFLAGS -W -Wall -Werror -std=c11 -pedantic -pipe"
LDFLAGS="--shared ${LDFLAGS}"
LIBS="$LIBS -rpath ${PREFIX}/lib"
config_asan
config_gnu
config_i386
pkg_config libbsd-overlay
pkg_config libffi
pkg_config libmd
pkg_config cairo
pkg_config cairo-ft
pkg_config freetype2
pkg_config xkbcommon
config_lib_have COCOA -framework Cocoa
if $HAVE_COCOA; then
config_objc_include_have COCOA '#import <Cocoa/Cocoa.h>'
fi
config_define PREFIX "\"${PREFIX}\""
# Address Sanitizer config
CPPFLAGS_ASAN="$CPPFLAGS"
CFLAGS_ASAN="$CFLAGS -O1 -fsanitize=address -fno-omit-frame-pointer -g"
LDFLAGS_ASAN="$LDFLAGS"
LIBS_LOCAL_ASAN="../libkc3_window_asan.la"
LIBS_ASAN="$LIBS_LOCAL_ASAN $LIBS"
# Coverage config
CPPFLAGS_COV="$CPPFLAGS"
CFLAGS_COV="$CFLAGS -ftest-coverage -fprofile-arcs -fprofile-generate"
LDFLAGS_COV="$LDFLAGS --coverage"
LIBS_LOCAL_COV="../libkc3_window_cov.la"
LIBS_COV="$LIBS_LOCAL_COV $LIBS"
# Debug config
CPPFLAGS_DEBUG="$CPPFLAGS"
CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -g"
LDFLAGS_DEBUG="$LDFLAGS"
LIBS_LOCAL_DEBUG="../libkc3_window_debug.la"
LIBS_DEBUG="$LIBS_LOCAL_DEBUG $LIBS"
# Main config
DEFAULT_CFLAGS="-O2 -fPIC"
if [ "x$ENV_CFLAGS" = "x" ]; then
CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
fi
CFLAGS="$CFLAGS -DNDEBUG"
LIBS_LOCAL="../libkc3_window.la"
LIBS="$LIBS_LOCAL $LIBS"
echo "LIB = $LIB" >> ${CONFIG_MK}
echo "HAVE_ASAN = $HAVE_ASAN" >> ${CONFIG_MK}
echo "CPPFLAGS = $CPPFLAGS" >> ${CONFIG_MK}
echo "CFLAGS = $CFLAGS" >> ${CONFIG_MK}
echo "LDFLAGS = $LDFLAGS" >> ${CONFIG_MK}
echo "LIBS = $LIBS" >> ${CONFIG_MK}
echo >> ${CONFIG_MK}
echo "LIB_ASAN = $LIB_ASAN" >> ${CONFIG_MK}
echo "CFLAGS_ASAN = $CFLAGS_ASAN" >> ${CONFIG_MK}
echo "LDFLAGS_ASAN = $LDFLAGS_ASAN" >> ${CONFIG_MK}
echo "LIBS_ASAN = $LIBS_ASAN" >> ${CONFIG_MK}
echo >> ${CONFIG_MK}
echo "LIB_COV = $LIB_COV" >> ${CONFIG_MK}
echo "CFLAGS_COV = $CFLAGS_COV" >> ${CONFIG_MK}
echo "LDFLAGS_COV = $LDFLAGS_COV" >> ${CONFIG_MK}
echo "LIBS_COV = $LIBS_COV" >> ${CONFIG_MK}
echo >> ${CONFIG_MK}
echo "LIB_DEBUG = $LIB_DEBUG" >> ${CONFIG_MK}
echo "CFLAGS_DEBUG = $CFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LDFLAGS_DEBUG = $LDFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LIBS_DEBUG = $LIBS_DEBUG" >> ${CONFIG_MK}
update_build
update_build_lib
build_lo
build_lib
if pkg-config cairo-xcb; then
HAVE_XCB=true
else
HAVE_XCB=false
fi
echo "HAVE_XCB = $HAVE_XCB" >> ${CONFIG_MK}
if pkg-config cairo-win32; then
HAVE_WIN32=true
else
HAVE_WIN32=false
fi
echo "HAVE_WIN32 = $HAVE_WIN32" >> ${CONFIG_MK}
update_config_mk
env_reset
config_subdirs demo
if ${HAVE_COCOA}; then
config_subdirs quartz
fi
if ${HAVE_WIN32}; then
config_subdirs win32
fi
if ${HAVE_XCB}; then
config_subdirs xcb
fi