Skip to content

Commit 65d6d81

Browse files
Merge pull request #2 from kristjanvalur/dev
Dev
2 parents e7878f9 + 8e01a2e commit 65d6d81

32 files changed

+685
-166
lines changed

.devcontainer/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.166.1/containers/ubuntu/.devcontainer/base.Dockerfile
2+
3+
# [Choice] Ubuntu version: bionic, focal
4+
ARG VARIANT="focal"
5+
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
6+
7+
# [Optional] Uncomment this section to install additional OS packages.
8+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
9+
&& apt-get -y install --no-install-recommends build-essential
10+
11+

.devcontainer/devcontainer.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.166.1/containers/ubuntu
3+
{
4+
"name": "Ubuntu",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
// Update 'VARIANT' to pick an Ubuntu version: focal, bionic
8+
"args": { "VARIANT": "focal" }
9+
},
10+
11+
// Set *default* container specific settings.json values on container create.
12+
"settings": {
13+
"terminal.integrated.shell.linux": "/bin/bash"
14+
},
15+
16+
// Add the IDs of extensions you want installed when the container is created.
17+
"extensions": [
18+
"ms-vscode.cpptools"
19+
],
20+
21+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
22+
// "forwardPorts": [],
23+
24+
// Use 'postCreateCommand' to run commands after the container is created.
25+
// "postCreateCommand": "uname -a",
26+
27+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
28+
"remoteUser": "vscode"
29+
}

.github/workflows/buildcommit.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: build test and commit
2+
3+
on:
4+
push:
5+
branches: [ master, dev ]
6+
7+
pull_request:
8+
branches: [ master ]
9+
10+
jobs:
11+
12+
build-linux-gnu:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
name: [AMD64, i386, arm, aarch64]
18+
include:
19+
- name: i386
20+
platformflags: -m32
21+
- name: arm
22+
platformtools: arm-linux-gnueabi
23+
emulator: qemu-arm
24+
- name: aarch64
25+
platformtools: aarch64-linux-gnu
26+
emulator: qemu-aarch64
27+
# name: build-linux-gnu (${{matrix.name}})
28+
env:
29+
PLATFORMFLAGS: ${{matrix.platformflags}}
30+
PLATFORM_PREFIX: ${{matrix.platformtools}}
31+
EMULATOR: ${{matrix.emulator}}
32+
steps:
33+
- uses: actions/checkout@v2
34+
- name: install multilib
35+
run: sudo apt-get install --no-install-recommends -y gcc-multilib g++-multilib
36+
if: ${{ matrix.name == 'i386' }}
37+
- name: install qemu
38+
if: matrix.emulator
39+
run: sudo apt-get install --no-install-recommends -y qemu-user
40+
- name: install abi lib
41+
if: matrix.platformtools
42+
run: sudo apt-get install --no-install-recommends -y gcc-${{matrix.platformtools}} g++-${{matrix.platformtools}}
43+
- name: make
44+
run: make all
45+
- name: test
46+
run: make test
47+
- name: set abi name
48+
run: echo abiname=$(make abiname) >> $GITHUB_ENV
49+
- name: Upload build artifacts
50+
uses: actions/upload-artifact@v2
51+
with:
52+
name: ${{ env.abiname }}
53+
path: lib/${{ env.abiname }}/libstackman.a
54+
55+
build-windows:
56+
runs-on: windows-2019
57+
strategy:
58+
fail-fast: true
59+
matrix:
60+
platform: [x86, x64, arm, arm64]
61+
include:
62+
- platform: x86
63+
folder: Win32
64+
native: yes
65+
- platform: x64
66+
folder: x64
67+
native: yes
68+
- platform: arm
69+
folder: arm
70+
- platform: arm64
71+
folder: arm64
72+
73+
steps:
74+
- uses: actions/checkout@v2
75+
- uses: microsoft/[email protected]
76+
- name: build
77+
run: msbuild.exe vs2019\stackman.sln /p:Platform=${{matrix.platform}}
78+
- name: strip timestamps from lib
79+
run: python tools/strip-lib.py lib/win_${{matrix.platform}}/stackman.lib
80+
- name: rebuild after stripping
81+
run: msbuild.exe vs2019\stackman.sln /p:Platform=${{matrix.platform}}
82+
- name: test
83+
if: ${{ matrix.native == 'yes' }}
84+
run: vs2019\${{matrix.folder}}\Debug\test.exe
85+
- name: Upload build artifacts
86+
uses: actions/upload-artifact@v2
87+
with:
88+
name: win_${{ matrix.platform }}
89+
path: lib/win_${{matrix.platform}}/stackman.lib
90+
91+
commit-artifacts:
92+
runs-on: ubuntu-latest
93+
needs: [build-linux-gnu, build-windows]
94+
if: ${{ github.event_name == 'push' }}
95+
steps:
96+
- uses: actions/checkout@v2
97+
- uses: actions/download-artifact@v2
98+
with:
99+
path: lib
100+
101+
- name: Commit changes
102+
run: |
103+
git config --global user.name 'Automation tool'
104+
git config --global user.email '[email protected]'
105+
git add lib/*.a lib/*.lib
106+
git status
107+
git diff-index --quiet HEAD || git commit -m "Automated build"
108+
git push

.github/workflows/test.yml

Lines changed: 0 additions & 74 deletions
This file was deleted.

Makefile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,31 @@ CXXFLAGS += $(NO_CET)
1212

1313
OLDCC := $(CC)
1414
ifdef PLATFORM_PREFIX
15-
CC = $(PLATFORM_PREFIX)gcc
16-
CXX = $(PLATFORM_PREFIX)g++
17-
LD = $(PLATFORM_PREFIX)ld
18-
AR = $(PLATFORM_PREFIX)ar
15+
CC = $(PLATFORM_PREFIX)-gcc
16+
CXX = $(PLATFORM_PREFIX)-g++
17+
LD = $(PLATFORM_PREFIX)-ld
18+
AR = $(PLATFORM_PREFIX)-ar
1919
endif
2020
# run c preprocessor with any cflags to get cross compilation result, then run regular compile in native
21-
ABI := $(shell ./abiname.sh "$(CC)" "$(CFLAGS)")
21+
ABI := $(shell sh tools/abiname.sh "$(CC)" "$(CFLAGS)")
2222
ifndef ABI
2323
$(error Could not determine platform)
24-
else
25-
$(info ABI is $(ABI))
2624
endif
2725

2826
LIB := lib/$(ABI)
2927

3028
all: $(LIB)/libstackman.a
3129

30+
# echo the abiname, for build tools.
31+
.PHONY: abiname
32+
abiname:
33+
@echo $(ABI)
34+
3235
obj = stackman/stackman.o stackman/stackman_s.o
3336

3437

3538
$(LIB)/libstackman.a: lib $(obj)
39+
$(info ABI is $(ABI))
3640
$(AR) $(ARFLAGS) -s $@ $(obj)
3741

3842
.PHONY: lib clean
@@ -42,7 +46,7 @@ lib:
4246
clean:
4347
rm -f stackman/*.o tests/*.o
4448
rm -f bin/*
45-
rm -rf tmp
49+
rm -rf tmp tools/tmp
4650

4751
DEBUG = #-DDEBUG_DUMP
4852

0 commit comments

Comments
 (0)