Skip to content

Commit

Permalink
Merge pull request #26 from lumag/meson
Browse files Browse the repository at this point in the history
Switch to meson build system and add CI
  • Loading branch information
Konrad Dybcio authored Nov 6, 2023
2 parents c674428 + d82ed4d commit dd604f9
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 88 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
50 changes: 0 additions & 50 deletions Makefile

This file was deleted.

22 changes: 1 addition & 21 deletions debugcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down
18 changes: 1 addition & 17 deletions debugcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 64 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit dd604f9

Please sign in to comment.