From a438efc8fb986c309de5a94cb243d9561b0bd338 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@bred.dog>
Date: Sun, 16 Aug 2020 17:51:57 -0400
Subject: [PATCH] Add autobuild skeleton

---
 .gitignore    |   2 +
 Pipfile       |  14 ++++++
 autobuild.xml | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++
 build-cmd.sh  |  83 +++++++++++++++++++++++++++++++
 4 files changed, 231 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 Pipfile
 create mode 100644 autobuild.xml
 create mode 100644 build-cmd.sh

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9b4a1e0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+stage/
+autobuild-parabuild-bootstrap/
diff --git a/Pipfile b/Pipfile
new file mode 100644
index 0000000..81e20ce
--- /dev/null
+++ b/Pipfile
@@ -0,0 +1,14 @@
+[[source]]
+url = "https://pypi.org/simple"
+verify_ssl = true
+name = "pypi"
+
+[dev-packages]
+
+[packages]
+llbase = "*"
+certifi = "*"
+autobuild = {git = "https://git.alchemyviewer.org/alchemy/autobuild.git"}
+
+[requires]
+python_version = "2.7"
diff --git a/autobuild.xml b/autobuild.xml
new file mode 100644
index 0000000..ce62109
--- /dev/null
+++ b/autobuild.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0" ?>
+<llsd>
+<map>
+    <key>package_description</key>
+    <map>
+      <key>canonical_repo</key>
+      <string>https://git.alchemyviewer.org/alchemy/thirdparty/3p-libepoxy</string>
+      <key>copyright</key>
+      <string>Copyright © 2013-2014 Intel Corporation</string>
+      <key>description</key>
+      <string>Epoxy is a library for handling OpenGL function pointer management for you.</string>
+      <key>license</key>
+      <string>MIT</string>
+      <key>license_file</key>
+      <string>LICENSES/libepoxy.txt</string>
+      <key>name</key>
+      <string>libepoxy</string>
+      <key>platforms</key>
+      <map>
+        <key>common</key>
+        <map>
+          <key>build_directory</key>
+          <string>stage</string>
+          <key>configurations</key>
+          <map>
+            <key>Release</key>
+            <map>
+              <key>build</key>
+              <map>
+                <key>arguments</key>
+                <array>
+                  <string>-c</string>
+                  <string>../build-cmd.sh</string>
+                </array>
+                <key>command</key>
+                <string>bash</string>
+              </map>
+              <key>name</key>
+              <string>Release</string>
+            </map>
+          </map>
+          <key>manifest</key>
+          <array>
+            <string>LICENSES/libepoxy.txt</string>
+            <string>include/epoxy/*.h</string>
+          </array>
+          <key>name</key>
+          <string>common</string>
+        </map>
+        <key>darwin</key>
+        <map>
+          <key>configurations</key>
+          <map>
+            <key>Release</key>
+            <map>
+              <key>build</key>
+              <map>
+              </map>
+              <key>default</key>
+              <boolean>true</boolean>
+              <key>name</key>
+              <string>Release</string>
+            </map>
+          </map>
+          <key>manifest</key>
+          <array>
+            <string>lib/debug/*.dylib</string>
+            <string>lib/release/*.dylib</string>
+          </array>
+          <key>name</key>
+          <string>darwin</string>
+        </map>
+        <key>linux</key>
+        <map>
+          <key>configurations</key>
+          <map>
+            <key>Release</key>
+            <map>
+              <key>build</key>
+              <map>
+              </map>
+              <key>default</key>
+              <boolean>true</boolean>
+              <key>name</key>
+              <string>Release</string>
+            </map>
+          </map>
+          <key>manifest</key>
+          <array>
+            <string>lib/debug/*.so*</string>
+            <string>lib/debug/*.a</string>
+            <string>lib/release/*.so*</string>
+            <string>lib/release/*.a</string>
+          </array>
+          <key>name</key>
+          <string>linux</string>
+        </map>
+        <key>windows</key>
+        <map>
+          <key>configurations</key>
+          <map>
+            <key>Release</key>
+            <map>
+              <key>build</key>
+              <map>
+              </map>
+              <key>default</key>
+              <boolean>true</boolean>
+              <key>name</key>
+              <string>Release</string>
+            </map>
+          </map>
+          <key>manifest</key>
+          <array>
+            <string>lib/debug/*</string>
+            <string>lib/release/*</string>
+          </array>
+          <key>name</key>
+          <string>windows</string>
+        </map>
+      </map>
+      <key>source_directory</key>
+      <string>libepoxy</string>
+      <key>version_file</key>
+      <string>VERSION.txt</string>
+    </map>
+    <key>type</key>
+    <string>autobuild</string>
+    <key>version</key>
+    <string>1.3</string>
+  </map>
+</llsd>
diff --git a/build-cmd.sh b/build-cmd.sh
new file mode 100644
index 0000000..9946c66
--- /dev/null
+++ b/build-cmd.sh
@@ -0,0 +1,83 @@
+#!/usr/bin/env bash
+
+cd "$(dirname "$0")"
+
+# turn on verbose debugging output for parabuild logs.
+exec 4>&1; export BASH_XTRACEFD=4; set -x
+# make errors fatal
+set -e
+# complain about unset env variables
+set -u
+
+if [ -z "$AUTOBUILD" ] ; then 
+    exit 1
+fi
+
+if [ "$OSTYPE" = "cygwin" ] ; then
+    autobuild="$(cygpath -u $AUTOBUILD)"
+else
+    autobuild="$AUTOBUILD"
+fi
+
+top="$(pwd)"
+stage="$(pwd)/stage"
+
+mkdir -p $stage
+
+# Load autobuild provided shell functions and variables
+source_environment_tempfile="$stage/source_environment.sh"
+"$autobuild" source_environment > "$source_environment_tempfile"
+. "$source_environment_tempfile"
+
+EPOXY_VERSION="1.5.4"
+EPOXY_SOURCE_DIR="libepoxy"
+
+VERSION_HEADER_FILE="$stage/include/epoxy/config.h"
+
+build=${AUTOBUILD_BUILD_ID:=0}
+
+# Create the staging folders
+mkdir -p "$stage/lib"/{debug,release,relwithdebinfo}
+mkdir -p "$stage/include/epoxy"
+mkdir -p "$stage/LICENSES"
+
+pushd "$EPOXY_SOURCE_DIR"
+    case "$AUTOBUILD_PLATFORM" in
+
+        # ------------------------ windows, windows64 ------------------------
+        windows*)
+            load_vsvars
+
+            if [ "$AUTOBUILD_ADDRSIZE" = 32 ]
+            then
+                archflags=""
+            else
+                archflags="/arch:AVX"
+            fi
+
+            meson build "_build" --prefix="${stage}"
+
+            mkdir -p "_build"
+            pushd "_build"
+                ninja
+                ninja install
+            popd
+        ;;
+
+        "darwin")
+        ;;
+        linux*)
+        ;;
+    esac
+    mkdir -p "$stage/LICENSES"
+    cp COPYING "$stage/LICENSES/libepoxy.txt"
+popd
+
+# version will be (e.g.) "1.4.0"
+version=`sed -n -E 's/#define PACKAGE_VERSION "([0-9])[.]([0-9])[.]([0-9]).*/\1.\2.\3/p' "${VERSION_HEADER_FILE}"`
+# shortver will be (e.g.) "230": eliminate all '.' chars
+#since the libs do not use micro in their filenames, chop off shortver at minor
+short="$(echo $version | cut -d"." -f1-2)"
+shortver="${short//.}"
+
+echo "${version}.${build}" > "${stage}/VERSION.txt"
-- 
GitLab