summaryrefslogtreecommitdiffstats
path: root/meta-selftest
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2019-06-25 15:52:02 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-27 11:14:02 +0100
commit7d5f39ca717fa1caea357a4366bbf106386432c0 (patch)
tree42ef1133ada7de2ac3536682b53a8dcf97911ed6 /meta-selftest
parentb14c17e9b1992a7f6c9acfa9ee82037325163b31 (diff)
downloadopenembedded-core-contrib-7d5f39ca717fa1caea357a4366bbf106386432c0.tar.gz
fortran-helloworld: add a very dumb Fortran Hello World for testing
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> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta-selftest')
-rw-r--r--meta-selftest/recipes-test/fortran/files/hello.f955
-rw-r--r--meta-selftest/recipes-test/fortran/fortran-helloworld.bb25
2 files changed, 30 insertions, 0 deletions
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 0000000000..a0745fc64d
--- /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 0000000000..97313d7e24
--- /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