Skip to content

Commit

Permalink
CI fixes (#8)
Browse files Browse the repository at this point in the history
* touch c-parse.c

* Run CI on pull requests

* update some actions

* Copy over egcs ci stuff

* remove uses of sys_nerr

* fix typo

* Yeet my_strerror
  • Loading branch information
AngheloAlf authored Jan 21, 2024
1 parent 8c900d1 commit e5f8659
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 54 deletions.
32 changes: 19 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Build

on: [push]
on: [push, pull_request]

jobs:
build:
Expand All @@ -22,44 +22,50 @@ jobs:
ARCHIVE_NAME: 'gcc-2.7.2-mac.tar.gz'
}

name: Building binutils for ${{ matrix.TARGET.OS }}
name: Building gcc for ${{ matrix.TARGET.OS }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install dependencies (Ubuntu)
shell: bash
if: matrix.TARGET.OS == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y build-essential bison file gperf gcc gcc-multilib
sudo apt-get install -y build-essential bison file gperf gcc gcc-multilib autoconf
- name: Configure for mips
shell: bash
run: |
./configure --target=mips-mips-gnu --prefix=/opt/cross --with-gnu-as --disable-gprof --disable-gdb --disable-werror --host=${{ matrix.TARGET.HOST }} --build=${{ matrix.TARGET.HOST }}
- name: Make
shell: bash
shell: bash # The generated `c-parse.c` is already commited on the repo, so we touch it to avoid regenerating it (trying to build old lex/yacc files with modern tools fails)
run: |
make cpp cc1 xgcc cc1plus g++ CFLAGS="${{ matrix.TARGET.CFLAGS }}"
touch c-parse.c
make CFLAGS="${{ matrix.TARGET.CFLAGS }}" xgcc cc1 cc1plus cpp cccp g++
- name: Test for file
shell: bash
run: |
test -f cc1
file cc1
./cc1 test.c
- name: Create release archive
shell: bash
run: |
cp xgcc gcc
tar -czf ${{ matrix.TARGET.ARCHIVE_NAME }} cpp cc1 gcc cc1plus g++
tar -czf ${{ matrix.TARGET.ARCHIVE_NAME }} gcc cc1 cc1plus cpp cccp g++
- name: Upload archive
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: binutils-2.7.2-${{ matrix.TARGET.OS }}
name: gcc-2.7.2-${{ matrix.TARGET.OS }}
path: |
${{ matrix.TARGET.ARCHIVE_NAME }}
- name: Update release
uses: johnwbyrd/[email protected]
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
- name: Publish release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: ${{ matrix.TARGET.ARCHIVE_NAME }}
44 changes: 3 additions & 41 deletions gcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1020,28 +1020,6 @@ translate_options (argcp, argvp)
*argcp = newindex;
}

char *
my_strerror(e)
int e;
{

#ifdef HAVE_STRERROR
return strerror(e);

#else

static char buffer[30];
if (!e)
return "";

if (e > 0 && e < sys_nerr)
return sys_errlist[e];

sprintf (buffer, "Unknown error %d", e);
return buffer;
#endif
}

/* Read compilation specs from a file named FILENAME,
replacing the default ones.
Expand Down Expand Up @@ -4731,26 +4709,14 @@ static void
pfatal_with_name (name)
char *name;
{
char *s;

if (errno < sys_nerr)
s = concat ("%s: ", my_strerror( errno ));
else
s = "cannot open `%s'";
fatal (s, name);
fatal ("%s: %s", name, strerror (errno));
}

static void
perror_with_name (name)
char *name;
{
char *s;

if (errno < sys_nerr)
s = concat ("%s: ", my_strerror( errno ));
else
s = "cannot open `%s'";
error (s, name);
error ("%s: %s", name, strerror (errno));
}

static void
Expand All @@ -4759,11 +4725,7 @@ perror_exec (name)
{
char *s;

if (errno < sys_nerr)
s = concat ("installation problem, cannot exec `%s': ",
my_strerror (errno));
else
s = "installation problem, cannot exec `%s'";
s = concat ("installation problem, cannot exec `%s': ", strerror (errno));
error (s, name);
}

Expand Down

0 comments on commit e5f8659

Please sign in to comment.