newapkbuild: add CMake support.
This is a first try that *might* work for cross-compiling packages with an absolute bare minimum of requirements, if you're lucky. I can't debug that part further, but the references should help with it.
This commit is contained in:
parent
5aa41e9fb2
commit
582b477817
|
@ -52,6 +52,34 @@ build_autotools() {
|
||||||
__EOF__
|
__EOF__
|
||||||
}
|
}
|
||||||
|
|
||||||
|
build_cmake() {
|
||||||
|
# References:
|
||||||
|
# http://www.cmake.org/Wiki/CMake_Useful_Variables
|
||||||
|
# http://www.vtk.org/Wiki/CMake_Cross_Compiling
|
||||||
|
# This is incomplete: CMAKE_{HOST_,}SYSTEM_PROCESSOR needs to be set,
|
||||||
|
# and likewise CMAKE_FIND_ROOT_PATH and a few other details.
|
||||||
|
|
||||||
|
sed -i -e 's/^\(makedepends="\)/\1cmake /' APKBUILD
|
||||||
|
cat >>APKBUILD<<__EOF__
|
||||||
|
if [ "$CBUILD" != "$CHOST" ]
|
||||||
|
then
|
||||||
|
CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
|
||||||
|
fi
|
||||||
|
cmake \\
|
||||||
|
-DCMAKE_INSTALL_PREFIX=/usr \\
|
||||||
|
-DCMAKE_INSTALL_LIBDIR=lib \\
|
||||||
|
-DBUILD_SHARED_LIBS=True \\
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \\
|
||||||
|
-DCMAKE_CXX_COMPILER="\${CXX:-g++}" \\
|
||||||
|
-DCMAKE_C_COMPILER="\${CC:-gcc}" \\
|
||||||
|
-DCMAKE_CXX_FLAGS="\$CXXFLAGS" \\
|
||||||
|
-DCMAKE_CXX_FLAGS="\$CFLAGS" \\
|
||||||
|
${CMAKE_CROSSOPTS} \\
|
||||||
|
|| return 1
|
||||||
|
make || return 1
|
||||||
|
__EOF__
|
||||||
|
}
|
||||||
|
|
||||||
build_perl() {
|
build_perl() {
|
||||||
cat >>APKBUILD<<__EOF__
|
cat >>APKBUILD<<__EOF__
|
||||||
PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor || return 1
|
PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor || return 1
|
||||||
|
@ -224,6 +252,8 @@ __EOF__
|
||||||
case "$buildtype" in
|
case "$buildtype" in
|
||||||
make)
|
make)
|
||||||
build_make;;
|
build_make;;
|
||||||
|
cmake)
|
||||||
|
build_cmake;;
|
||||||
autotools)
|
autotools)
|
||||||
build_autotools;;
|
build_autotools;;
|
||||||
perl)
|
perl)
|
||||||
|
@ -281,6 +311,7 @@ Options:
|
||||||
-l Set package license to LICENSE
|
-l Set package license to LICENSE
|
||||||
-u Set package URL
|
-u Set package URL
|
||||||
-a Create autotools (use ./configure ...)
|
-a Create autotools (use ./configure ...)
|
||||||
|
-C Create CMake pakckage (Assume cmake/ is there)
|
||||||
-p Create perl package (Assume Makefile.PL is there)
|
-p Create perl package (Assume Makefile.PL is there)
|
||||||
-y Create python package (Assume setup.py is there)
|
-y Create python package (Assume setup.py is there)
|
||||||
-s Use sourceforge source URL
|
-s Use sourceforge source URL
|
||||||
|
@ -295,6 +326,7 @@ while getopts "acd:fhl:n:pyu:s" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
'a') buildtype="autotools";;
|
'a') buildtype="autotools";;
|
||||||
'c') cpinitd=1;;
|
'c') cpinitd=1;;
|
||||||
|
'C') buildtype="cmake";;
|
||||||
'd') pkgdesc="$OPTARG";;
|
'd') pkgdesc="$OPTARG";;
|
||||||
'f') force=1;;
|
'f') force=1;;
|
||||||
'h') usage; exit;;
|
'h') usage; exit;;
|
||||||
|
|
Loading…
Reference in New Issue