Skip to content

Commit

Permalink
Initial testing
Browse files Browse the repository at this point in the history
  • Loading branch information
staticfloat committed May 6, 2019
0 parents commit a0d05d3
Show file tree
Hide file tree
Showing 12 changed files with 181 additions and 0 deletions.
5 changes: 5 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

for PROJ in c_simple cxx_string_expansion fortran_expansion; do
(cd ${PROJ}; julia --color=yes build_tarballs.jl --verbose --debug)
done
32 changes: 32 additions & 0 deletions c_simple/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using BinaryBuilder

name = "c_simple"
version = v"1.2.3"

# Collection of sources required to build libffi
sources = [
"./bundled",
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/
make install
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = supported_platforms()

# The products that we will ensure are always built
products(prefix) = [
LibraryProduct(prefix, "libc_simple", :libc_simple)
]

# Dependencies that must be installed before this package can be built
dependencies = [
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies)

15 changes: 15 additions & 0 deletions c_simple/bundled/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
all: c_simple libc_simple.$(dlext)

libc_simple.$(dlext): libc_simple.c
$(CC) $(CPPFLAGS) $(CFLAGS) libc_simple.c -shared -o $@ $(LDFLAGS)

c_simple: c_simple.c libc_simple.$(dlext)
$(CC) $(CPPFLAGS) $(CFLAGS) c_simple.c -o $@ $(LDFLAGS) -L. -lc_simple

install: all
mkdir -p $(libdir) $(prefix)/bin
cp -a libc_simple.$(dlext) $(libdir)/libc_simple.$(dlext)
cp -a c_simple $(prefix)/bin/c_simple$(exeext)

clean:
rm -f libc_simple.$(dlext) c_simple
17 changes: 17 additions & 0 deletions c_simple/bundled/c_simple.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <stdio.h>
#include <stdlib.h>

int my_add(int x, int y);

int main(int argc, char ** argv) {
if (argc != 3) {
printf("Usage: c_simple <x> <y>\n");
return 1;
}

int x = atoi(argv[1]);
int y = atoi(argv[1]);
int z = my_add(x, y);
printf("%d + %d == %d\n", x, y, z);
return 0;
}
3 changes: 3 additions & 0 deletions c_simple/bundled/libc_simple.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int my_add(int x, int y) {
return x + y;
}
32 changes: 32 additions & 0 deletions cxx_string_expansion/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using BinaryBuilder

name = "cxx_string"
version = v"1.2.3"

# Collection of sources required to build libffi
sources = [
"./bundled",
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/
make install
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = expand_cxx_versions(supported_platforms())

# The products that we will ensure are always built
products(prefix) = [
LibraryProduct(prefix, "libcxx_string", :libcxx_string)
]

# Dependencies that must be installed before this package can be built
dependencies = [
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies)

11 changes: 11 additions & 0 deletions cxx_string_expansion/bundled/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
all: libcxx_string.$(dlext)

libcxx_string.$(dlext): libcxx_string.cc
$(CXX) $(CPPFLAGS) $(CFLAGS) -fPIC $< -shared -o $@ $(LDFLAGS)

install: all
mkdir -p $(libdir)
cp -a libcxx_string.$(dlext) $(libdir)/libcxx_string.$(dlext)

clean:
rm -f libcxx_string.$(dlext)
9 changes: 9 additions & 0 deletions cxx_string_expansion/bundled/libcxx_string.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <string>

std::string generate(void) {
return std::string("Hello there!");
}

int length(std::string foo) {
return foo.length();
}
32 changes: 32 additions & 0 deletions fortran_expansion/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using BinaryBuilder

name = "fortran_expansion"
version = v"1.2.3"

# Collection of sources required to build libffi
sources = [
"./bundled",
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/
make install
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = expand_gfortran_versions(supported_platforms())

# The products that we will ensure are always built
products(prefix) = [
ExecutableProduct(prefix, "hello_fortran", :hello_fortran)
]

# Dependencies that must be installed before this package can be built
dependencies = [
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies)

16 changes: 16 additions & 0 deletions fortran_expansion/bundled/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
all: hello_fortran libhello_fortran.$(dlext)

libhello_fortran.$(dlext): libhello.f
$(FC) $(FPPFLAGS) $(FFLAGS) $< -shared -o $@ $(LDFLAGS)

hello_fortran: hello.f
$(FC) $(FPPFLAGS) $(FFLAGS) $< -o $@ $(LDFLAGS)

install: all
mkdir -p $(libdir) $(prefix)/bin
cp -a libhello_fortran.$(dlext) $(libdir)/libhello_fortran.$(dlext)
cp -a hello_fortran $(prefix)/bin/hello_fortran$(exeext)

clean:
rm -f libhello_fortran.$(dlext) hello_fortran

3 changes: 3 additions & 0 deletions fortran_expansion/bundled/hello.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
program hello
print *, "Hello World!"
end program hello
6 changes: 6 additions & 0 deletions fortran_expansion/bundled/libhello.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FUNCTION my_sum(x,y)
REAL:: my_sum
REAL:: x, y
my_sum = x + y
END

0 comments on commit a0d05d3

Please sign in to comment.