~alpine/devel

4 3

[alpine-devel] [PATCH] newapkbuild: add CMake support.

Isaac Dunham
Details
Message ID
<1427855404-5412-1-git-send-email-ibid.ag@gmail.com>
Sender timestamp
1427855404
DKIM signature
missing
Download raw message
Patch: +32 -0
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
---

[alpine-devel] Re: [PATCH] newapkbuild: add CMake support.

Isaac Dunham
Details
Message ID
<20150508222632.GA1856@newbook>
In-Reply-To
<1427855404-5412-1-git-send-email-ibid.ag@gmail.com> (view parent)
Sender timestamp
1431123996
DKIM signature
missing
Download raw message
On Tue, Mar 31, 2015 at 07:30:04PM -0700, Isaac Dunham wrote:
> 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.

Ping.

While I can't test cross-compiling, I can tell that the cmake APKBUILDs
that are in common use are far short of what we need for cross-compiling.

Thanks,
Isaac Dunham

> ---
>  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
---

Re: [alpine-devel] Re: [PATCH] newapkbuild: add CMake support.

Carlo Landmeter
Details
Message ID
<CA+cSEmOn4VzP3q6Rh1U669wB8BMKp8o0KckbQJUgDqVdKQx0Fw@mail.gmail.com>
In-Reply-To
<20150508222632.GA1856@newbook> (view parent)
Sender timestamp
1431157578
DKIM signature
missing
Download raw message
Please use alpine-aports for patches. They will be visible in
patchwork.alpinelinux.org and not forgotten.

Re: [alpine-devel] Re: [PATCH] newapkbuild: add CMake support.

Natanael Copa
Details
Message ID
<20150526141635.732e0fd0@ncopa-desktop.alpinelinux.org>
In-Reply-To
<20150508222632.GA1856@newbook> (view parent)
Sender timestamp
1432642595
DKIM signature
missing
Download raw message
On Fri, 8 May 2015 15:26:36 -0700
Isaac Dunham <ibid.ag@gmail.com> wrote:

> On Tue, Mar 31, 2015 at 07:30:04PM -0700, Isaac Dunham wrote:
> > 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.
> 
> Ping.

sorry for not responding.

I will look at it after v3.2


> 
> While I can't test cross-compiling, I can tell that the cmake APKBUILDs
> that are in common use are far short of what we need for cross-compiling.
> 
> Thanks,
> Isaac Dunham

PS. I do have some code for the mdev -i stuff too, i just need git push
it. That is also put on suspend til after v3.2 release.

-nc


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Natanael Copa
Details
Message ID
<20150527090950.43816234@ncopa-desktop.alpinelinux.org>
In-Reply-To
<1427855404-5412-1-git-send-email-ibid.ag@gmail.com> (view parent)
Sender timestamp
1432710590
DKIM signature
missing
Download raw message
On Tue, 31 Mar 2015 19:30:04 -0700
Isaac Dunham <ibid.ag@gmail.com> wrote:

> 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(+)

Applied!



> +		-DCMAKE_CXX_COMPILER="\${CXX:-g++}" \\
> +		-DCMAKE_C_COMPILER="\${CC:-gcc}" \\
> +		-DCMAKE_CXX_FLAGS="\$CXXFLAGS" \\
> +		-DCMAKE_CXX_FLAGS="\$CFLAGS" \\


I am slightly in doubt if setting -DCMAKE_CXX_COMPILER is a good idea.
This made building llvm with cmake break with ccache.

I had to do this:
http://git.alpinelinux.org/cgit/aports/commit/main/llvm?id=f38ff631e3623c3a1f8983ae906c86d6c10258a3

I applied your patch as-is anyway, so we can test it.

Thanks!

-nc


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---