Make configure/make compatible with autotools
This commit is contained in:
parent
e872356b17
commit
e910b39751
|
@ -17,19 +17,28 @@ foreach(plugin ${PLUGINS})
|
|||
endforeach(plugin)
|
||||
|
||||
# Prepare instal paths
|
||||
message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
|
||||
macro(set_path what val desc)
|
||||
if(NOT ${what})
|
||||
unset(${what} CACHE)
|
||||
set(${what} ${val})
|
||||
endif()
|
||||
message(STATUS "${desc}: ${${what}}")
|
||||
endmacro(set_path)
|
||||
|
||||
string(REGEX REPLACE "^liblib" "lib" LIBDIR_NAME "lib${LIB_SUFFIX}")
|
||||
set(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share")
|
||||
message(STATUS "Installation directory for architecture-independent files: ${CMAKE_INSTALL_PREFIX}")
|
||||
set_path(EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" "Installation directory for architecture-dependent files")
|
||||
set_path(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Installation directory for read-only architecture-independent data")
|
||||
|
||||
set_path(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" "Installation directory for user executables")
|
||||
set_path(DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/dino" "Installation directory for dino-specific data")
|
||||
set_path(DESKTOP_FILE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications" "Installation directory for .desktop files")
|
||||
set_path(ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "Installation directory for icons")
|
||||
set_path(INCLUDE_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/include" "Installation directory for C header files")
|
||||
set_path(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/${LIBDIR_NAME}" "Installation directory for object code libraries")
|
||||
set_path(PLUGIN_INSTALL_DIR "${DATA_INSTALL_DIR}/plugins" "Installation directory for dino plugin object code files")
|
||||
set_path(VAPI_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/vala/vapi" "Installation directory for Vala API files")
|
||||
|
||||
set(APPLICATION_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications")
|
||||
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
|
||||
set(DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/dino")
|
||||
set(ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons")
|
||||
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include")
|
||||
set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIBDIR_NAME}")
|
||||
set(PLUGIN_INSTALL_DIR "${DATA_INSTALL_DIR}/plugins")
|
||||
set(VAPI_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/vala/vapi")
|
||||
set(TARGET_INSTALL LIBRARY DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION ${BIN_INSTALL_DIR} PUBLIC_HEADER DESTINATION ${INCLUDE_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
|
||||
set(PLUGIN_INSTALL LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR} RUNTIME DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
|
||||
|
@ -57,6 +66,20 @@ AddValaCFlagIfSupported(-Wno-deprecated-declarations)
|
|||
AddValaCFlagIfSupported(-Wno-incompatible-pointer-types)
|
||||
AddValaCFlagIfSupported(-Wno-int-conversion)
|
||||
AddValaCFlagIfSupported(-Wno-discarded-qualifiers)
|
||||
AddValaCFlagIfSupported(-Wno-unused-but-set-variable)
|
||||
AddValaCFlagIfSupported(-Wno-unused-variable)
|
||||
AddValaCFlagIfSupported(-Wno-unused-function)
|
||||
AddValaCFlagIfSupported(-Wno-unused-label)
|
||||
|
||||
if($ENV{USE_CCACHE})
|
||||
# Configure CCache if available
|
||||
find_program(CCACHE_FOUND ccache)
|
||||
if(CCACHE_FOUND)
|
||||
message(STATUS "Using ccache")
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
||||
endif(CCACHE_FOUND)
|
||||
endif($ENV{USE_CCACHE})
|
||||
|
||||
if(NOT NO_DEBUG)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
|
||||
|
@ -66,6 +89,10 @@ endif(NOT NO_DEBUG)
|
|||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
if(NOT VALA_EXECUTABLE)
|
||||
unset(VALA_EXECUTABLE CACHE)
|
||||
endif()
|
||||
|
||||
find_package(Vala 0.30 REQUIRED)
|
||||
if(VALA_VERSION VERSION_GREATER "0.34.90" AND VALA_VERSION VERSION_LESS "0.36.1")
|
||||
# Due to a bug on 0.36.0 (and pre-releases), we need to disable FAST_VAPI
|
||||
|
|
125
configure
vendored
125
configure
vendored
|
@ -1,42 +1,99 @@
|
|||
#!/bin/bash
|
||||
|
||||
OPTS=`getopt -o "h" --long prefix:,enable-plugin:,disable-plugin:,valac:,valac-flags:,lib-suffix:,help,disable-fast-vapi,no-debug,fetch-only -n './configure' -- "$@"`
|
||||
OPTS=`getopt -o "h" --long \
|
||||
help,fetch-only,no-debug,disable-fast-vapi,\
|
||||
enable-plugin:,disable-plugin:,\
|
||||
prefix:,program-prefix:,exec-prefix:,lib-suffix:,\
|
||||
bindir:,libdir:,includedir:,datadir:,\
|
||||
host:,build:,\
|
||||
sbindir:,sysconfdir:,libexecdir:,localstatedir:,sharedstatedir:,mandir:,infodir:,\
|
||||
enable-dependency-tracking,disable-dependency-tracking\
|
||||
-n './configure' -- "$@"`
|
||||
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
|
||||
|
||||
eval set -- "$OPTS"
|
||||
|
||||
PREFIX=${PREFIX:-/usr/local}
|
||||
VALA_EXECUTABLE=${VALA_EXECUTABLE:-$(which valac)}
|
||||
ENABLED_PLUGINS=
|
||||
DISABLED_PLUGINS=
|
||||
VALAC_FLAGS=
|
||||
DISABLE_FAST_VAPI=
|
||||
LIB_SUFFIX=
|
||||
NO_DEBUG=
|
||||
FETCH_ONLY=
|
||||
|
||||
EXEC_PREFIX=
|
||||
BINDIR=
|
||||
SBINDIR=n
|
||||
SYSCONFDIR=
|
||||
DATADIR=
|
||||
INCLUDEDIR=
|
||||
LIBDIR=
|
||||
LIBEXECDIR=
|
||||
LOCALSTATEDIR=
|
||||
SHAREDSTATEDIR=
|
||||
MANDIR=
|
||||
INFODIR=
|
||||
|
||||
help() {
|
||||
cat << EOF
|
||||
Usage:
|
||||
./configure [OPTIONS]...
|
||||
./configure [OPTION]...
|
||||
|
||||
Options:
|
||||
Defaults for the options (based on current environment) are specified in
|
||||
brackets.
|
||||
|
||||
Configuration:
|
||||
-h, --help Print this help and exit
|
||||
--prefix=PREFIX Prepend PREFIX to program installation paths. [$PREFIX]
|
||||
--lib-suffix=SUFFIX Append SUFFIX to the directory name for libraries
|
||||
--fetch-only Only fetch the files required to run ./configure
|
||||
without network access later and exit
|
||||
--no-debug Build without debug symbols
|
||||
--disable-fast-vapi Disable the usage of Vala compilers fast-vapi
|
||||
feature. fast-vapi mode is slower when doing
|
||||
clean builds, but faster when doing incremental
|
||||
builds (during development).
|
||||
|
||||
Plugin configuration:
|
||||
--enable-plugin=PLUGIN Enable compilation of plugin PLUGIN.
|
||||
--disable-plugin=PLUGIN Disable compilation of plugin PLUGIN.
|
||||
|
||||
--valac=VALAC Use VALAC as Vala pre-compiler. [$VALA_EXECUTABLE]
|
||||
--valac-flags=FLAGS Use FLAGS when invoking the vala compiler
|
||||
--disable-fast-vapi Disable the usage of Vala compilers fast-vapi feature.
|
||||
fast-vapi mode is slower when doing clean builds, but
|
||||
faster when doing incremental builds (during development)
|
||||
Installation directories:
|
||||
--prefix=PREFIX Install architecture-independent files in PREFIX
|
||||
[$PREFIX]
|
||||
--program-prefix=PREFIX Same as --prefix
|
||||
--exec-prefix= Install architecture-dependent files in EPREFIX
|
||||
[PREFIX]
|
||||
--lib-suffix=SUFFIX Append SUFFIX to the directory name for libraries
|
||||
|
||||
By default, \`make install' will install all the files in
|
||||
\`/usr/local/bin', \`/usr/local/lib' etc. You can specify
|
||||
an installation prefix other than \`/usr/local' using \`--prefix',
|
||||
for instance \`--prefix=\$HOME'.
|
||||
|
||||
For better control, use the options below.
|
||||
|
||||
Fine tuning of the installation directories:
|
||||
--bindir=DIR user executables [EPREFIX/bin]
|
||||
--libdir=DIR object code libraries [EPREFIX/lib]
|
||||
--includedir=DIR C header files [PREFIX/include]
|
||||
--datadir=DIR read-only data [PREFIX/share]
|
||||
|
||||
For compatibility with autotools, these options will be silently ignored:
|
||||
--host, --build, --sbindir, --sysconfdir, --libexecdir, --sharedstatedir,
|
||||
--localstatedir, --mandir, --infodir, --enable-dependency-tracking,
|
||||
--disable-dependency-tracking
|
||||
|
||||
Some influential environment variables:
|
||||
CC C compiler command
|
||||
CFLAGS C compiler flags
|
||||
PKG_CONFIG_PATH directories to add to pkg-config's search path
|
||||
PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path
|
||||
USE_CCACHE decide to use ccache when compiling C objects
|
||||
VALAC Vala compiler command
|
||||
VALACFLAGS Vala compiler flags
|
||||
|
||||
Use these variables to override the choices made by \`configure' or to help
|
||||
it to find libraries and programs with nonstandard names/locations.
|
||||
|
||||
--fetch-only Only fetch the files required to run ./configure without
|
||||
network access later and exit
|
||||
EOF
|
||||
}
|
||||
|
||||
|
@ -51,6 +108,24 @@ while true; do
|
|||
--disable-fast-vapi ) DISABLE_FAST_VAPI=yes; shift ;;
|
||||
--no-debug ) NO_DEBUG=yes; shift ;;
|
||||
--fetch-only ) FETCH_ONLY=yes; shift ;;
|
||||
# Autotools paths
|
||||
--program-prefix ) PREFIX="$2"; shift; shift ;;
|
||||
--exec-prefix ) EXEC_PREFIX="$2"; shift; shift ;;
|
||||
--bindir ) BINDIR="$2"; shift; shift ;;
|
||||
--datadir ) DATADIR="$2"; shift; shift ;;
|
||||
--includedir ) INCLUDEDIR="$2"; shift; shift ;;
|
||||
--libdir ) LIBDIR="$2"; shift; shift ;;
|
||||
# Autotools paths not used
|
||||
--sbindir ) SBINDIR="$2"; shift; shift ;;
|
||||
--sysconfdir ) SYSCONFDIR="$2"; shift; shift ;;
|
||||
--libexecdir ) LIBEXECDIR="$2"; shift; shift ;;
|
||||
--localstatedir ) LOCALSTATEDIR="$2"; shift; shift ;;
|
||||
--sharedstatedir ) SHAREDSTATEDIR="$2"; shift; shift ;;
|
||||
--mandir ) MANDIR="$2"; shift; shift ;;
|
||||
--infodir ) INFODIR="$2"; shift; shift ;;
|
||||
# Ignore for autotools compat
|
||||
--host | --build ) shift; shift ;;
|
||||
--disable-dependency-tracking | --enable-dependency-tracking ) shift ;;
|
||||
-h | --help ) help; exit 0 ;;
|
||||
-- ) shift; break ;;
|
||||
* ) break ;;
|
||||
|
@ -75,7 +150,11 @@ else
|
|||
echo "Failed retrieving missing files"
|
||||
exit 5
|
||||
fi
|
||||
git clone "$url" "$path" 2>/dev/null
|
||||
res=$(git clone "$url" "$path" 2>&1)
|
||||
if ! [ $? -eq 0 ] || ! [ -x $git ]; then
|
||||
echo "Failed retrieving missing files: $res"
|
||||
exit 5
|
||||
fi
|
||||
if [[ "$branch" != "" ]]; then
|
||||
pushd "$path" > /dev/null
|
||||
git checkout "$branch" 2>/dev/null
|
||||
|
@ -151,7 +230,21 @@ mkdir -p build
|
|||
cd build
|
||||
|
||||
echo "$cmake_type" > .cmake_type
|
||||
cmake -G "$cmake_type" -DCMAKE_INSTALL_PREFIX="$PREFIX" -DENABLED_PLUGINS="$ENABLED_PLUGINS" -DDISABLED_PLUGINS="$DISABLED_PLUGINS" -DVALA_EXECUTABLE="$VALA_EXECUTABLE" -DCMAKE_VALA_FLAGS="$VALAC_FLAGS" -DDISABLE_FAST_VAPI="$DISABLE_FAST_VAPI" -DLIB_SUFFIX="$LIB_SUFFIX" -DNO_DEBUG="$NO_DEBUG" .. || exit 9
|
||||
cmake -G "$cmake_type" \
|
||||
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
|
||||
-DENABLED_PLUGINS="$ENABLED_PLUGINS" \
|
||||
-DDISABLED_PLUGINS="$DISABLED_PLUGINS" \
|
||||
-DVALA_EXECUTABLE="$VALAC" \
|
||||
-DCMAKE_VALA_FLAGS="$VALACFLAGS" \
|
||||
-DDISABLE_FAST_VAPI="$DISABLE_FAST_VAPI" \
|
||||
-DLIB_SUFFIX="$LIB_SUFFIX" \
|
||||
-DNO_DEBUG="$NO_DEBUG" \
|
||||
-DEXEC_INSTALL_PREFIX="$EXEC_PREFIX" \
|
||||
-DSHARE_INSTALL_PREFIX="$DATADIR" \
|
||||
-DBIN_INSTALL_DIR="$BINDIR" \
|
||||
-DINCLUDE_INSTALL_DIR="$INCLUDEDIR" \
|
||||
-DLIB_INSTALL_DIR="$LIBDIR" \
|
||||
.. || exit 9
|
||||
|
||||
if [ "$cmake_type" == "Ninja" ]
|
||||
then
|
||||
|
|
|
@ -69,11 +69,11 @@ developing plugins for %{name}.
|
|||
#%setup -n "dino-%{commit}"
|
||||
|
||||
%build
|
||||
./configure --prefix="%{buildroot}%{_prefix}" --valac="%{_bindir}/valac%{?vala_version_suffix}" --lib-suffix="%{_lib}"
|
||||
%configure
|
||||
make
|
||||
|
||||
%install
|
||||
make install
|
||||
make install DESTDIR="%{buildroot}"
|
||||
desktop-file-validate %{buildroot}%{_datadir}/applications/dino.desktop
|
||||
|
||||
%post
|
||||
|
|
|
@ -114,7 +114,7 @@ if(WIN32)
|
|||
endif(WIN32)
|
||||
|
||||
install(TARGETS dino ${TARGET_INSTALL})
|
||||
install(FILES data/dino.desktop DESTINATION ${APPLICATION_INSTALL_DIR})
|
||||
install(FILES data/dino.desktop DESTINATION ${DESKTOP_FILE_INSTALL_DIR})
|
||||
install(FILES data/icons/dino.svg DESTINATION ${ICON_INSTALL_DIR}/hicolor/scalable/apps)
|
||||
install(FILES data/icons/dino-symbolic.svg DESTINATION ${ICON_INSTALL_DIR}/hicolor/symbolic/apps)
|
||||
install(FILES
|
||||
|
|
Loading…
Reference in a new issue