Merge pull request #26 from lumag/meson

Switch to meson build system and add CI
This commit is contained in:
Konrad Dybcio
2023-11-06 12:24:08 +01:00
committed by GitHub
5 changed files with 154 additions and 88 deletions

88
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,88 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright (c) 2023 Linaro Ltd.
#
name: "Builds"
on:
pull_request:
push:
schedule:
# Run periodically to check that it still compiles
- cron: '13 13 * * 1'
workflow_dispatch:
jobs:
job:
name: Build
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
strategy:
fail-fast: false
matrix:
container:
- debian:testing
- debian:bookworm
#- debian:bullseye
#- debian:buster
- ubuntu:lunar
- ubuntu:jammy
#- ubuntu:focal
#- ubuntu:bionic
#- ubuntu:xenial
target:
- native
- aarch64-linux-gnu
- arm-linux-gnueabihf
container:
image: ${{ matrix.container }}
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Install meson
run: |
apt update
apt -y install --no-install-recommends meson build-essential
- name: Install cross-compilers
if:${{ matrix.target }} != 'native'
run: |
apt -y install gcc-${{ matrix.target }}
FAMILY=$(echo ${{ matrix.target }} | cut -d- -f 1)
if [ "${FAMILY}" = "aarch64" ] ; then
CPU="arm64"
elif [ "${FAMILY}" = "arm" ] ; then
CPU="arm"
else
echo "Unknown CPU family ${FAMILY}"
exit 1
fi
cat > cross.txt << EOF
[binaries]
c = '${{ matrix.target }}-gcc'
strip = '${{ matrix.target }}-strip'
pkgconfig = 'pkg-config'
[host_machine]
system = 'linux'
cpu_family = '${FAMILY}'
cpu = 'arm64'
endian = 'litle'
[properties]
pkg_config_libdir = '/usr/lib/${{ matrix.target }}/pkgconfig'
EOF
cat cross.txt
- name: Build
run: |
if [ ${{ matrix.target }} = "native" ] ; then
meson setup . build --werror
else
meson setup --cross-file cross.txt . build --werror
fi
ninja -C build
ninja -C build install

View File

@@ -1,50 +0,0 @@
OUT := debugcc
CC=aarch64-linux-gnu-gcc
CFLAGS := -O2 -Wall -g
LDFLAGS := -static -static-libgcc
prefix := /usr/local
SRCS := debugcc.c \
msm8936.c \
msm8994.c \
msm8996.c \
msm8998.c \
qcs404.c \
sc8280xp.c \
sdm845.c \
sm6115.c \
sm6125.c \
sm6350.c \
sm6375.c \
sm8150.c \
sm8250.c \
sm8350.c \
sm8450.c \
sm8550.c
OBJS := $(SRCS:.c=.o)
$(OUT): $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS)
ln -f $(OUT) msm8936-debugcc
ln -f $(OUT) msm8994-debugcc
ln -f $(OUT) msm8996-debugcc
ln -f $(OUT) msm8998-debugcc
ln -f $(OUT) qcs404-debugcc
ln -f $(OUT) sc8280xp-debugcc
ln -f $(OUT) sdm845-debugcc
ln -f $(OUT) sm6115-debugcc
ln -f $(OUT) sm6125-debugcc
ln -f $(OUT) sm6350-debugcc
ln -f $(OUT) sm6375-debugcc
ln -f $(OUT) sm8150-debugcc
ln -f $(OUT) sm8250-debugcc
ln -f $(OUT) sm8350-debugcc
ln -f $(OUT) sm8450-debugcc
ln -f $(OUT) sm8550-debugcc
$(OBJS): %.o: debugcc.h
clean:
rm -f $(OUT) $(OBJS) *-debugcc

View File

@@ -42,26 +42,6 @@
#include "debugcc.h"
static const struct debugcc_platform *platforms[] = {
&msm8936_debugcc,
&msm8994_debugcc,
&msm8996_debugcc,
&msm8998_debugcc,
&qcs404_debugcc,
&sc8280xp_debugcc,
&sdm845_debugcc,
&sm6115_debugcc,
&sm6125_debugcc,
&sm6350_debugcc,
&sm6375_debugcc,
&sm8150_debugcc,
&sm8250_debugcc,
&sm8350_debugcc,
&sm8450_debugcc,
&sm8550_debugcc,
NULL
};
static uint32_t readl(void *ptr)
{
return *((volatile uint32_t*)ptr);
@@ -312,7 +292,7 @@ int mmap_mux(int devmem, struct debug_mux *mux)
mux->base = mmap(0, mux->size, PROT_READ | PROT_WRITE, MAP_SHARED, devmem, mux->phys);
if (mux->base == (void *)-1) {
warn("failed to map %#zx", mux->phys);
warn("failed to map %#lx", mux->phys);
return -1;
}

View File

@@ -89,22 +89,6 @@ void mux_enable(struct debug_mux *mux);
void mux_disable(struct debug_mux *mux);
unsigned long measure_mccc(const struct measure_clk *clk);
extern struct debugcc_platform msm8936_debugcc;
extern struct debugcc_platform msm8994_debugcc;
extern struct debugcc_platform msm8996_debugcc;
extern struct debugcc_platform msm8998_debugcc;
extern struct debugcc_platform qcs404_debugcc;
extern struct debugcc_platform sc8280xp_debugcc;
extern struct debugcc_platform sdm845_debugcc;
extern struct debugcc_platform sm6115_debugcc;
extern struct debugcc_platform sm6125_debugcc;
extern struct debugcc_platform sm6350_debugcc;
extern struct debugcc_platform sm6375_debugcc;
extern struct debugcc_platform sm8150_debugcc;
extern struct debugcc_platform sm8250_debugcc;
extern struct debugcc_platform sm8350_debugcc;
extern struct debugcc_platform sm8450_debugcc;
extern struct debugcc_platform sm8550_debugcc;
extern const struct debugcc_platform *platforms[];
#endif

64
meson.build Normal file
View File

@@ -0,0 +1,64 @@
# SPDX-License-Identifier: BSD-3-Clause
project('debugcc',
'c',
license: ['BSD-3-Clause'],
meson_version : '>= 0.61.0', # for install_symlink
default_options: [
'buildtype=release',
]
)
platforms = [
'msm8936',
'msm8994',
'msm8996',
'msm8998',
'qcs404',
'sc8280xp',
'sdm845',
'sm6115',
'sm6125',
'sm6350',
'sm6375',
'sm8150',
'sm8250',
'sm8350',
'sm8450',
'sm8550',
]
debugcc_srcs = [
'debugcc.c',
]
platform_defs = []
platform_array = ['const struct debugcc_platform *platforms[] = {']
foreach p: platforms
debugcc_srcs += p + '.c'
platform_defs += 'extern struct debugcc_platform ' + p + '_debugcc;'
platform_array += '\t&' + p + '_debugcc,'
install_symlink(p + '-debugcc',
install_dir: get_option('bindir'),
pointing_to: 'debugcc')
endforeach
platform_array += '\tNULL,'
platform_array += '};'
debugcc_srcs += configure_file(
output: 'platforms.c',
capture: true,
command: ['echo',
'/* Autogenerated file, do not edit */\n\n' +
'#include <stdlib.h>\n\n' +
'\n'.join(platform_defs) +
'\n\n' +
'\n'.join(platform_array)
])
executable('debugcc',
debugcc_srcs,
install: true)