Skip to content

Commit

Permalink
Update to latest glfw version
Browse files Browse the repository at this point in the history
  • Loading branch information
borodust committed Oct 1, 2018
1 parent 7519a92 commit 55cf6ea
Show file tree
Hide file tree
Showing 14 changed files with 128 additions and 30 deletions.
41 changes: 35 additions & 6 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ image:
environment:
global:
NAME: glfw
ASDF_SYSTEM: bodge-glfw
matrix:
- platform: x64
ARCH: x86_64
TARGET_ARCH: x86_64
CFLAGS: -m64
PATH: C:\msys64\mingw64\bin\;C:\msys64\usr\bin\;$(PATH)
PACKAGES: mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
- platform: x86
ARCH: i686
TARGET_ARCH: i686
CFLAGS: -m32
PATH: C:\msys64\mingw32\bin\;C:\msys64\usr\bin\;$(PATH)
PACKAGES: mingw-w64-i686-toolchain mingw-w64-i686-cmake
Expand All @@ -24,26 +25,54 @@ branches:
- "/^v\\d+(\\.\\d+)+$/"

install:
- set APPVEYOR_BUILD_DIR=$(cygpath -u '%APPVEYOR_BUILD_FOLDER%')
- git submodule update --init --recursive
- >
sh -c "
pacman --needed --noconfirm -S zip unzip base-devel %PACKAGES% &&
curl -L http://bodge.borodust.org/files/install.sh | sh &&
curl -L http://bodge.borodust.org/files/c2ffi-windows-x86_64.zip -o /tmp/c2ffi.zip &&
cd ~/bin/ && unzip /tmp/c2ffi.zip
"
build_script:
- set TARGET_ARTIFACT=lib%NAME%.dll.bodged-%ARCH%-windows-%APPVEYOR_REPO_TAG_NAME%
- pacman -S --needed --noconfirm base-devel %PACKAGES%
- sh -c "cd lib && cmake -G \"Unix Makefiles\" -DCMAKE_C_FLAGS=%CFLAGS% -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON -DLIBRARY_OUTPUT_PATH=$APPVEYOR_BUILD_FOLDER/lib -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF -DGLFW_INSTALL=OFF -DGLFW_BUILD_EXAMPLES=OFF . && make"
- set TARGET_ARTIFACT=lib%NAME%.dll.bodged-%TARGET_ARCH%-windows-%APPVEYOR_REPO_TAG_NAME%
- set SPEC_ARCHIVE=%TARGET_ARTIFACT%-spec.zip
- >
sh -c "
cd lib
&& cmake -G \"Unix Makefiles\" -DCMAKE_C_FLAGS=%CFLAGS% -DCMAKE_BUILD_TYPE=Release
-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON
-DLIBRARY_OUTPUT_PATH=$APPVEYOR_BUILD_FOLDER/lib -DGLFW_BUILD_TESTS=OFF
-DGLFW_BUILD_DOCS=OFF -DGLFW_INSTALL=OFF -DGLFW_BUILD_EXAMPLES=OFF .
&& make"
- mv %APPVEYOR_BUILD_FOLDER%\lib\lib%NAME%.dll.bodged %APPVEYOR_BUILD_FOLDER%\%TARGET_ARTIFACT%
- >
sh -c "
export PATH=$HOME/bin/:$PATH
&& rm -rf %APPVEYOR_BUILD_DIR%/spec/*
&& ln -s %APPVEYOR_BUILD_DIR%/ ~/quicklisp/local-projects/
&& $HOME/bin/lisp %APPVEYOR_BUILD_DIR%/regen-spec.lisp %TARGET_ARCH% '%ASDF_SYSTEM%'
&& cd ~/quicklisp/local-projects/%ASDF_SYSTEM%/ && zip -r spec.zip spec/
&& mv ~/quicklisp/local-projects/%ASDF_SYSTEM%/spec.zip %APPVEYOR_BUILD_DIR%/
"
- mv %APPVEYOR_BUILD_FOLDER%\spec.zip %APPVEYOR_BUILD_FOLDER%\%SPEC_ARCHIVE%

artifacts:
- path: $(TARGET_ARTIFACT)
name: target_artifact

- path: $(SPEC_ARCHIVE)
name: spec_archive

deploy:
provider: GitHub
release: $(APPVEYOR_REPO_TAG_NAME)
tag: $(APPVEYOR_REPO_TAG_NAME)
description: $(APPVEYOR_REPO_COMMIT_MESSAGE)
auth_token:
secure: Z5XWjDOBlCrmfz3SQAjnLKtdgI5B2b/owJhRPNWYGrI+qwVNbBc4cZiroBZReWP7
artifact: target_artifact
artifact: target_artifact, spec_archive
force_update: true
draft: false
prerelease: false
Expand Down
48 changes: 34 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,36 @@
language: c
sudo: false

addons:
apt:
packages:
- gcc-multilib
- xorg-dev
sudo: true
dist: xenial

env:
global:
- NAME: glfw
- ASDF_SYSTEM: bodge-glfw
- secure: Yug8ZSWsbZKP6p5AbVZ3TG2XiukvZpZPc6K3er+b+576lYhJqgs9EI6wCMsfZtXV8A/Ez+49iW0dEBABOHCNe5mvX6Kr4vACoqywVmJ7IVvpt6hpqNjbQ/nMEdLaf/izxrnL8YKqU8qYcF+aJc4T3EOaz5nKgt2pfZuXgpwSbOhRhQbPxjJ45gyqvYJbccvk72h1WrFnU926EfQ7THb/7VHJLidH+eH5GE+mLj9NY1tZYqNI0LTApVkTBxkfvz8gAC8ZR30W/eitah/cEzBROuvmspvU8CpOib2sfQdm3XDJ0LMo7kwlfUbNshM9l2gNzruwWoDOEtGspnb4Rixll3ZzLFRrlTmlV2a2NfKLCcyeakvRiYzrmcZu8lr3Ve0pZ3WYP2c6a1CnU6FL6kVxEJ+D+EXJLmfIZbZDkxbV39ui+PgaRdQ/CUijVfyn/2XZf8FwJpdJhYSJyznPeAg+7C1U2ea+f2smoAHv/Y7TtetqQip/O8ycKnCfUT6TRZ5JRslY75s8qZE3Q/6XQWWfO3rigrGSKL5tuN4uoB3OM5JeN9m7p1ltklaXh6Mfiph8/WnLtlAFGKh2B9RuOPU3ffcIYudHIy7dVPuGkVwdvbQuroDQZEnrxO5ptefT8qlaKJzs/aczlgm9F6qKu1p/BS5XAJjvWj9g1oulWAwctRU=

matrix:
include:
- os: linux
env:
- ARCH=i686
- TARGET_ARCH=i686
- CFLAGS=-m32
- EXTENSION=so
- OUTPUT_FILE=lib$NAME.$EXTENSION.bodged
- os: linux
env:
- ARCH=x86_64
- TARGET_ARCH=x86_64
- CFLAGS=-m64
- EXTENSION=so
- OUTPUT_FILE=lib$NAME.$EXTENSION.bodged
- os: osx
env:
- ARCH=i686
- TARGET_ARCH=i686
- CFLAGS=-m32
- EXTENSION=dylib
- OUTPUT_FILE=lib$NAME.bodged.$EXTENSION
- os: osx
env:
- ARCH=x86_64
- TARGET_ARCH=x86_64
- CFLAGS=-m64
- EXTENSION=dylib
- OUTPUT_FILE=lib$NAME.bodged.$EXTENSION
Expand All @@ -44,9 +40,23 @@ branches:
- "/^v\\d+(\\.\\d+)+$/"


before_install:
- >
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
sudo apt-get update -q
sudo -E apt-get -yq --no-install-suggests --no-install-recommends install patchelf gcc-multilib xorg-dev
fi
install:
- git submodule update --init --recursive
- curl -L http://bodge.borodust.org/files/install.sh | sh
- curl -L http://bodge.borodust.org/files/c2ffi-$TRAVIS_OS_NAME-$TARGET_ARCH.zip -o /tmp/c2ffi.zip
- cd ~/bin/ && unzip /tmp/c2ffi.zip
- ln -s $TRAVIS_BUILD_DIR/ ~/quicklisp/local-projects/$ASDF_SYSTEM

script:
- >
cd lib/ && cmake -G "Unix Makefiles" \
cd $TRAVIS_BUILD_DIR/lib/ && cmake -G "Unix Makefiles" \
-DCMAKE_C_FLAGS=$(CFLAGS) \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
Expand All @@ -57,15 +67,25 @@ script:
-DGLFW_INSTALL=OFF \
-DGLFW_BUILD_EXAMPLES=OFF . && \
make
- rm -rf $TRAVIS_BUILD_DIR/spec/*
- lisp "$TRAVIS_BUILD_DIR/regen-spec.lisp" $TARGET_ARCH "$ASDF_SYSTEM"
- cd $TRAVIS_BUILD_DIR/ && zip -r spec.zip spec/

before_deploy:
- export TARGET_FILE=$TRAVIS_BUILD_DIR/lib$NAME.$EXTENSION.bodged-$ARCH-$TRAVIS_OS_NAME-$TRAVIS_BRANCH
- export TARGET_FILE=$TRAVIS_BUILD_DIR/lib$NAME.$EXTENSION.bodged-$TARGET_ARCH-$TRAVIS_OS_NAME-$TRAVIS_BRANCH
- mv $TRAVIS_BUILD_DIR/lib/$OUTPUT_FILE $TARGET_FILE
- >
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
patchelf --set-rpath '@ORIGIN/' "$TARGET_FILE";
patchelf --set-soname "lib$NAME.$EXTENSION.bodged" "$TARGET_FILE";
fi
- export SPEC_ARCHIVE=$TARGET_FILE-spec.zip
- mv $TRAVIS_BUILD_DIR/spec.zip $SPEC_ARCHIVE

deploy:
provider: releases
api-key: $GITHUB_TOKEN
file: $TARGET_FILE
file: [$TARGET_FILE, $SPEC_ARCHIVE]
skip_cleanup: true
overwrite: true
on:
Expand Down
1 change: 1 addition & 0 deletions bodge-glfw.asd
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
(:static-file "bodge_glfw.h")
(:file "claw")
(:file "glfw")
(:module glfw-includes :pathname "lib/glfw/include/")
(:module spec)))


Expand Down
6 changes: 3 additions & 3 deletions bodge_glfw.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef _BODGE_CHIPMUNK_H_
#define _BODGE_CHIPMUNK_H_
#ifndef _BODGE_GLFW_H_
#define _BODGE_GLFW_H_

#include <GLFW/glfw3.h>

#endif /* _BODGE_CHIPMUNK_H_ */
#endif /* _BODGE_GLFW_H_ */
2 changes: 2 additions & 0 deletions claw.lisp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
(claw:c-include "bodge_glfw.h" bodge-glfw
:in-package :%glfw
:local-only t
:sysincludes (:glfw-includes)
:include-definitions ("(glfw|GLFW)\\w*")
:exclude-definitions ("^(GL|gl)(?!(FW|fw))\\w*"
"^PFN\\w*"
Expand Down
2 changes: 1 addition & 1 deletion lib/glfw
Submodule glfw updated 144 files
9 changes: 9 additions & 0 deletions regen-spec.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(bind-arguments *target-arch* *system-name*)
(script "install-testing-dist")

(ql:register-local-projects)
(ql:quickload :claw)

(let ((claw::*local-cpu* *target-arch*)
(claw::*trace-c2ffi* t))
(ql:quickload *system-name*))
2 changes: 1 addition & 1 deletion spec/bodge_glfw.i686-apple-darwin-gnu.spec

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion spec/bodge_glfw.i686-pc-linux-gnu.spec

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion spec/bodge_glfw.i686-pc-windows-gnu.spec

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion spec/bodge_glfw.x86_64-apple-darwin-gnu.spec

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion spec/bodge_glfw.x86_64-pc-linux-gnu.spec

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion spec/bodge_glfw.x86_64-pc-windows-gnu.spec

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions update-specs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

name=glfw
repository_url=https://github.com/borodust/bodge-glfw


if [[ -z $1 ]] ; then
echo "Version is not provided!"
exit 1;
fi

script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

declare -A platforms
platforms=(["linux"]="so" ["osx"]="dylib" ["windows"]="dll")

declare -A archs
archs=(["x86_64"]="x86_64" ["i686"]="x86")

for arch in "${!archs[@]}" ; do
for platform in "${!platforms[@]}" ; do
lib="lib$name.${platforms[$platform]}.bodged"
url="$repository_url/releases/download/$1/$lib-$arch-$platform-$1"

spec_dir="$script_dir/"
spec_url="$url-spec.zip"
spec_archive=$(mktemp /tmp/$lib-spec.XXXXXXXX)
mkdir -p "$spec_dir"

echo "Downloading $lib spec from $spec_url to $spec_archive"
if ! wget -O "$spec_archive" -q "$spec_url" ; then
echo "$lib spec download failed"
exit 1;
fi
( cd $spec_dir && unzip -o $spec_archive )
done
done

0 comments on commit 55cf6ea

Please sign in to comment.