X-Original-To: alpine-devel@lists.alpinelinux.org Delivered-To: alpine-devel@mail.alpinelinux.org Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id B6DF1DC00B7 for ; Wed, 1 Apr 2015 02:30:23 +0000 (UTC) Received: by patj18 with SMTP id j18so37675381pat.2 for ; Tue, 31 Mar 2015 19:30:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=ih6U7uoIL3GgVrKJwBKnxCZ71XIDP4H8euU64xI3BA4=; b=ucQ+VxXveAPqlQLIv/S81ZkJHl/kJwRimAUFiegLXCeDal+syinLQPFU8+txqnlnhi yt8FlQmT5dkw4+gDG+A+m7S2Q2Qb86wEX0rMFNs5YxjWwmwmlVccTy2VqAIyDr57Utgc fc6eG4ouksjEljN66Vpz9oL8Pye9yAmoJTpBJhLtWnFL6RK61B1i8vEYaUDVUWJj4QcD G4tXhleexITNbe66D2Dfg1lThv5Q7SjnVjcdkEExLEn71lRrCZOB6rbsrQ/2mv4B8tSE d/tQIN1E+3sDXenMPnKfWhIMI/FZ/4xvT1a2XtHYwVAvv2I/vdvDygmde0yHAHyxgS9J e97Q== X-Received: by 10.67.8.73 with SMTP id di9mr72439718pad.107.1427855422706; Tue, 31 Mar 2015 19:30:22 -0700 (PDT) Received: from localhost.localdomain ([50.0.225.244]) by mx.google.com with ESMTPSA id ll2sm295469pbc.11.2015.03.31.19.30.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 31 Mar 2015 19:30:21 -0700 (PDT) From: Isaac Dunham To: alpine-devel@lists.alpinelinux.org Cc: Isaac Dunham Subject: [alpine-devel] [PATCH] newapkbuild: add CMake support. Date: Tue, 31 Mar 2015 19:30:04 -0700 Message-Id: <1427855404-5412-1-git-send-email-ibid.ag@gmail.com> X-Mailer: git-send-email 2.3.4 X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: 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. --- newapkbuild.in | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/newapkbuild.in b/newapkbuild.in index 952980f..d2951e4 100644 --- a/newapkbuild.in +++ b/newapkbuild.in @@ -52,6 +52,34 @@ build_autotools() { __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() { cat >>APKBUILD<<__EOF__ PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor || return 1 @@ -224,6 +252,8 @@ __EOF__ case "$buildtype" in make) build_make;; + cmake) + build_cmake;; autotools) build_autotools;; perl) @@ -281,6 +311,7 @@ Options: -l Set package license to LICENSE -u Set package URL -a Create autotools (use ./configure ...) + -C Create CMake pakckage (Assume cmake/ is there) -p Create perl package (Assume Makefile.PL is there) -y Create python package (Assume setup.py is there) -s Use sourceforge source URL @@ -295,6 +326,7 @@ while getopts "acd:fhl:n:pyu:s" opt; do case $opt in 'a') buildtype="autotools";; 'c') cpinitd=1;; + 'C') buildtype="cmake";; 'd') pkgdesc="$OPTARG";; 'f') force=1;; 'h') usage; exit;; -- 2.3.4 --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---