[v2,1/2] fortran-helloworld: add a very dumb Fortran Hello World for testing

Message ID 20190625145203.24342-1-ross.burton@intel.com
State Accepted
Commit 7d5f39ca717fa1caea357a4366bbf106386432c0
Headers show
Series
  • [v2,1/2] fortran-helloworld: add a very dumb Fortran Hello World for testing
Related show

Commit Message

Ross Burton June 25, 2019, 2:52 p.m.
For future runtime testing something more complex is preferred but this is
sufficient to exercise the cross compiler.

Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 meta-selftest/recipes-test/fortran/files/hello.f95 |  5 +++++
 .../recipes-test/fortran/fortran-helloworld.bb     | 25 ++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 meta-selftest/recipes-test/fortran/files/hello.f95
 create mode 100644 meta-selftest/recipes-test/fortran/fortran-helloworld.bb

-- 
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

Khem Raj July 31, 2019, 5:10 a.m. | #1
On Tue, Jun 25, 2019 at 7:52 AM Ross Burton <ross.burton@intel.com> wrote:
>

> For future runtime testing something more complex is preferred but this is

> sufficient to exercise the cross compiler.

>

> Signed-off-by: Ross Burton <ross.burton@intel.com>

> ---

>  meta-selftest/recipes-test/fortran/files/hello.f95 |  5 +++++

>  .../recipes-test/fortran/fortran-helloworld.bb     | 25 ++++++++++++++++++++++

>  2 files changed, 30 insertions(+)

>  create mode 100644 meta-selftest/recipes-test/fortran/files/hello.f95

>  create mode 100644 meta-selftest/recipes-test/fortran/fortran-helloworld.bb

>

> diff --git a/meta-selftest/recipes-test/fortran/files/hello.f95 b/meta-selftest/recipes-test/fortran/files/hello.f95

> new file mode 100644

> index 00000000000..a0745fc64d7

> --- /dev/null

> +++ b/meta-selftest/recipes-test/fortran/files/hello.f95

> @@ -0,0 +1,5 @@

> +program helloworld

> +

> +      print * , "Hello World!"

> +

> +end program helloworld

> diff --git a/meta-selftest/recipes-test/fortran/fortran-helloworld.bb b/meta-selftest/recipes-test/fortran/fortran-helloworld.bb

> new file mode 100644

> index 00000000000..97313d7e249

> --- /dev/null

> +++ b/meta-selftest/recipes-test/fortran/fortran-helloworld.bb

> @@ -0,0 +1,25 @@

> +SUMMARY = "Fortran Hello World"

> +LICENSE = "MIT"

> +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"

> +

> +DEPENDS = "libgfortran"

> +

> +SRC_URI = "file://hello.f95"

> +

> +# These set flags that Fortran doesn't support

> +SECURITY_CFLAGS = ""

> +SECURITY_LDFLAGS = ""

> +

> +do_compile() {

> +       ${HOST_PREFIX}gfortran ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS} ${WORKDIR}/hello.f95 -o ${B}/fortran-hello


perhaps we can use ${FC} variable here.
> +}

> +

> +do_install() {

> +       install -d ${D}${bindir}

> +       install ${B}/fortran-hello ${D}${bindir}


Just do install -D -m 0755 install ${B}/fortran-hello
${D}${bindir}/fortran-hello

> +}

> +

> +python () {

> +    if not d.getVar("FORTRAN"):

> +        raise bb.parse.SkipRecipe("Fortran isn't enabled")

> +}

> \ No newline at end of file

> --

> 2.11.0

>

> --

> _______________________________________________

> Openembedded-core mailing list

> Openembedded-core@lists.openembedded.org

> http://lists.openembedded.org/mailman/listinfo/openembedded-core

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Ross Burton July 31, 2019, 11:37 a.m. | #2
On 31/07/2019 06:10, Khem Raj wrote:
>> +do_compile() {

>> +       ${HOST_PREFIX}gfortran ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS} ${WORKDIR}/hello.f95 -o ${B}/fortran-hello

> 

> perhaps we can use ${FC} variable here.


Yes, not sure how I didn't spot that!

Patch incoming.

Ross
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Patch

diff --git a/meta-selftest/recipes-test/fortran/files/hello.f95 b/meta-selftest/recipes-test/fortran/files/hello.f95
new file mode 100644
index 00000000000..a0745fc64d7
--- /dev/null
+++ b/meta-selftest/recipes-test/fortran/files/hello.f95
@@ -0,0 +1,5 @@ 
+program helloworld
+
+      print * , "Hello World!"
+
+end program helloworld
diff --git a/meta-selftest/recipes-test/fortran/fortran-helloworld.bb b/meta-selftest/recipes-test/fortran/fortran-helloworld.bb
new file mode 100644
index 00000000000..97313d7e249
--- /dev/null
+++ b/meta-selftest/recipes-test/fortran/fortran-helloworld.bb
@@ -0,0 +1,25 @@ 
+SUMMARY = "Fortran Hello World"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+DEPENDS = "libgfortran"
+
+SRC_URI = "file://hello.f95"
+
+# These set flags that Fortran doesn't support
+SECURITY_CFLAGS = ""
+SECURITY_LDFLAGS = ""
+
+do_compile() {
+	${HOST_PREFIX}gfortran ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS} ${WORKDIR}/hello.f95 -o ${B}/fortran-hello
+}
+
+do_install() {
+	install -d ${D}${bindir}
+	install ${B}/fortran-hello ${D}${bindir}
+}
+
+python () {
+    if not d.getVar("FORTRAN"):
+        raise bb.parse.SkipRecipe("Fortran isn't enabled")
+}
\ No newline at end of file