Skip to content

Commit dcd0550

Browse files
authored
Merge pull request #14 from cpmech/test-on-arch-linux
Add scripts to compile on Arch Linux
2 parents ebf344a + d93748b commit dcd0550

File tree

9 files changed

+83
-13
lines changed

9 files changed

+83
-13
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Test on Arch Linux
2+
on: [pull_request]
3+
jobs:
4+
test_on_arch_linux:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- name: Build docker image
9+
run: |
10+
bash zscripts/docker-build-image.bash arch

Dockerfile.Arch

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM archlinux:base-devel
2+
3+
# initialize
4+
RUN pacman -Sy go git --noconfirm
5+
6+
# set user
7+
RUN useradd -G wheel -m user
8+
RUN echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
9+
RUN chown -R user:wheel /usr/local/src/
10+
USER user
11+
WORKDIR /usr/local/src/
12+
13+
# install yay
14+
RUN git clone https://aur.archlinux.org/yay.git
15+
RUN cd yay && makepkg -si --noconfirm
16+
RUN sudo rm -f \
17+
/var/cache/pacman/pkg/* \
18+
/var/lib/pacman/sync/* \
19+
/README \
20+
/etc/pacman.d/mirrorlist.pacnew
21+
22+
# install libraries
23+
RUN yay -Y --gendb --noconfirm && yay -Y --devel --save
24+
25+
# install rust
26+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y
27+
ENV PATH="/home/user/.cargo/bin:${PATH}"
28+
29+
# copy files
30+
COPY --chown=user:user . tritet
31+
WORKDIR tritet
32+
33+
# run tests
34+
RUN cargo test

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[![Test](https://github.com/cpmech/tritet/actions/workflows/test_and_coverage.yml/badge.svg)](https://github.com/cpmech/tritet/actions/workflows/test_and_coverage.yml)
44
[![Windows & macOS](https://github.com/cpmech/tritet/actions/workflows/windows_and_macos.yml/badge.svg)](https://github.com/cpmech/tritet/actions/workflows/windows_and_macos.yml)
5+
[![Test on Arch Linux](https://github.com/cpmech/tritet/actions/workflows/test_on_arch_linux.yml/badge.svg)](https://github.com/cpmech/tritet/actions/workflows/test_on_arch_linux.yml)
56

67
## Contents
78

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ fn main() {
88
.flag("-Wno-unused-parameter")
99
.flag("-Wno-unused-but-set-variable")
1010
.flag("-Wno-maybe-uninitialized")
11+
.flag("-Wno-old-style-definition")
1112
.compile("c_code_interface_triangle");
1213
cc::Build::new()
1314
.cpp(true)

c_code/interface_triangle.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33

44
#include <inttypes.h>
55

6-
#define REAL double
7-
#define ANSI_DECLARATORS
8-
#define VOID int32_t
96
#include "triangle.h"
10-
#undef REAL
11-
#undef ANSI_DECLARATORS
12-
#undef VOID
137

148
struct ExtTrigen {
159
struct triangulateio input;

c_code/triangle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@
312312
/* compiler is smarter, feel free to replace the "int" with "void". */
313313
/* Not that it matters. */
314314

315-
#define VOID int
315+
/* #define VOID int Dorival: no longer needed because it goes in triangle.h */
316316

317317
/* Two constants for algorithms based on random sampling. Both constants */
318318
/* have been chosen empirically to optimize their respective algorithms. */

c_code/triangle.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,12 @@
248248
/* */
249249
/*****************************************************************************/
250250

251+
/* Dorival: Place this here to avoid complications with different compilers. */
252+
#include <inttypes.h>
253+
#define REAL double
254+
#define ANSI_DECLARATORS
255+
#define VOID int32_t
256+
251257
struct triangulateio {
252258
REAL *pointlist; /* In / out */
253259
REAL *pointattributelist; /* In / out */

c_code/tricall_report.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
#include <stdio.h>
22
#include <stdlib.h>
33

4-
#define REAL double
5-
#define ANSI_DECLARATORS
6-
#define VOID int
74
#include "triangle.h"
8-
#undef REAL
9-
#undef ANSI_DECLARATORS
10-
#undef VOID
115

126
void report(struct triangulateio *io,
137
int markers,

zscripts/docker-build-image.bash

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# the first argument is the distro: "arch" or "rocky"
6+
# the second argument is "1" to enable MUMPS
7+
DISTRO=${1:-""}
8+
9+
# image name
10+
NAME="cpmech/tritet_ubuntu"
11+
DKFILE="Dockerfile.Ubuntu"
12+
if [ "${DISTRO}" = "arch" ]; then
13+
NAME="cpmech/tritet_arch"
14+
DKFILE="Dockerfile.Arch"
15+
fi
16+
if [ "${DISTRO}" = "rocky" ]; then
17+
NAME="cpmech/tritet_rocky"
18+
DKFILE="Dockerfile.Rocky"
19+
fi
20+
21+
# build Docker image
22+
docker build -f $DKFILE -t $NAME .
23+
24+
echo
25+
echo
26+
echo
27+
echo "... SUCCESS ..."
28+
echo
29+
echo "... image ${NAME} created ..."
30+
echo

0 commit comments

Comments
 (0)