Skip to content

Commit

Permalink
Fix amiga os build and add ci.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolf3s committed Jun 4, 2024
1 parent 60b5657 commit 3ea8eed
Show file tree
Hide file tree
Showing 8 changed files with 134 additions and 58 deletions.
110 changes: 74 additions & 36 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,53 @@ jobs:
run: |
make -f Makefile.platform ps2_iop_all clean
build-ps3-ppu:
name: PS3 PPU build

runs-on: ubuntu-20.04
steps:

- name: Checkout
uses: actions/checkout@v3

- name: Set env vars
id: slug
run: |
echo "sha_name=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV
# using pre-compiled sdk
- name: Download PSL1GHT Toolchain
run: |
curl -sL https://github.com/bucanero/ps3toolchain/releases/download/ubuntu-latest-fad3b5fb/ps3dev-ubuntu-latest-2020-08-31.tar.gz | tar xvz -C ./
echo "PS3DEV=${GITHUB_WORKSPACE}/ps3dev" >> $GITHUB_ENV
echo "PSL1GHT=${GITHUB_WORKSPACE}/ps3dev" >> $GITHUB_ENV
- name: build libsmb2
run: |
cd lib
make -f Makefile.PS3_PPU clean
make -f Makefile.PS3_PPU
build-ps4:
name: PS4

runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Create Build Environment
run: >
sudo apt-get update &&
sudo apt-get install -y wget cmake git gettext smpq &&
wget https://github.com/PacBrew/pacbrew-pacman/releases/download/v1.1/pacbrew-pacman-1.1.deb &&
sudo dpkg -i pacbrew-pacman-1.1.deb && sudo pacbrew-pacman -Sy &&
sudo pacbrew-pacman --noconfirm -S ps4-openorbis ps4-openorbis-portlibs
- name: build libsmb2
run: |
make -f Makefile.platform ps4_all clean
build-switch:
name: SWITCH build

Expand Down Expand Up @@ -164,49 +211,40 @@ jobs:
run: |
make -f Makefile.platform nds_all clean
build-ps3-ppu:
name: PS3 PPU build
build-Amiga-OS3:
name: Amiga OS3 build

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container: amigadev/crosstools:m68k-amigaos
steps:
- name: Install dependencies
run: |
apt-get update -y && apt-get install -y ffmpeg gettext smpq
- name: Checkout
- name: git checkout
uses: actions/checkout@v3

- name: Set env vars
id: slug
run: |
echo "sha_name=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV
# using pre-compiled sdk
- name: Download PSL1GHT Toolchain
run: |
curl -sL https://github.com/bucanero/ps3toolchain/releases/download/ubuntu-latest-fad3b5fb/ps3dev-ubuntu-latest-2020-08-31.tar.gz | tar xvz -C ./
echo "PS3DEV=${GITHUB_WORKSPACE}/ps3dev" >> $GITHUB_ENV
echo "PSL1GHT=${GITHUB_WORKSPACE}/ps3dev" >> $GITHUB_ENV
- name: build libsmb2
- name: Compile AMIGA OS3
run: |
cd lib
make -f Makefile.PS3_PPU clean
make -f Makefile.PS3_PPU
build-ps4:
name: PS4

runs-on: ubuntu-22.04
make -f Makefile.AMIGA_OS3 clean
make -f Makefile.AMIGA_OS3
build-Amiga-OS:
name: Amiga build

runs-on: ubuntu-latest
container: amigadev/crosstools:ppc-amigaos
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
apt-get update -y && apt-get install -y ffmpeg gettext smpq
- name: Create Build Environment
run: >
sudo apt-get update &&
sudo apt-get install -y wget cmake git gettext smpq &&
wget https://github.com/PacBrew/pacbrew-pacman/releases/download/v1.1/pacbrew-pacman-1.1.deb &&
sudo dpkg -i pacbrew-pacman-1.1.deb && sudo pacbrew-pacman -Sy &&
sudo pacbrew-pacman --noconfirm -S ps4-openorbis ps4-openorbis-portlibs
- name: build libsmb2
- name: git checkout
uses: actions/checkout@v3

- name: Compile AMIGA OS
run: |
make -f Makefile.platform ps4_all clean
cd lib
make -f Makefile.AMIGA clean
make -f Makefile.AMIGA
4 changes: 2 additions & 2 deletions include/portable-endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
#define be64toh(x) (x)
#define le64toh(x) __bswap64(x)

#elif defined(__GNUC__)
#elif defined(__GNUC__) || defined(__AMIGA__)

#define htobe16(x) (x)
#define htole16(x) __builtin_bswap16(x)
Expand Down Expand Up @@ -314,7 +314,7 @@

#define htobe64(x) __bswap64(x)
#define htole64(x) (x)
#define bfe64toh(x) __bswap64(x)
#define be64toh(x) __bswap64(x)
#define le64toh(x) (x)

#else
Expand Down
5 changes: 3 additions & 2 deletions lib/Makefile.AMIGA
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ STRIP = ppc-amigaos-strip

OPTIMIZE = -O2
DEBUG = -gstabs
WARNINGS = -Wall -Werror -Wwrite-strings
WARNINGS = -Wall -Wno-pointer-sign -Wno-discarded-qualifiers -Wwrite-strings
#TODO: -Werror
INCLUDES = -I. -I../include -I../include/smb2 -I../include/amiga_os
DEFINES = -DHAVE_CONFIG_H "-D_U_=__attribute__((unused))" -DNEED_POLL -DNEED_GETADDRINFO -DNEED_FREEADDRINFO -DNEED_GETLOGIN_R -DNEED_RANDOM -DNEED_SRANDOM
DEFINES = -DHAVE_CONFIG_H "-D_U_=__attribute__((unused))" -DNEED_POLL -DNEED_GETADDRINFO -DNEED_FREEADDRINFO -DNEED_GETLOGIN_R -DHAVE_LINGER

CFLAGS = $(OPTIMIZE) $(DEBUG) $(WARNINGS) $(INCLUDES) $(DEFINES)

Expand Down
2 changes: 1 addition & 1 deletion lib/Makefile.AMIGA_AROS
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ OPTIMIZE = -O2 -fno-common -fomit-frame-pointer
DEBUG = -g
WARNINGS = -Wall -Werror
INCLUDES = -I. -I../include -I../include/smb2 -I../include/amiga_os
DEFINES = -DHAVE_CONFIG_H "-D_U_=__attribute__((unused))" -DNEED_POLL -DNEED_GETADDRINFO -DNEED_FREEADDRINFO -DNEED_GETLOGIN_R
DEFINES = -DHAVE_CONFIG_H "-D_U_=__attribute__((unused))" -DNEED_POLL -DNEED_GETADDRINFO -DNEED_FREEADDRINFO -DNEED_GETLOGIN_R -DHAVE_LINGER

ifeq (x86_64,$(CPU))
# Fixes duplicate member th_off/th_x2 errors in <netinet/tcp.h>
Expand Down
2 changes: 1 addition & 1 deletion lib/Makefile.AMIGA_OS3
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ OPTIMIZE = -O2 -noixemul -fno-common -fomit-frame-pointer
DEBUG = -g
WARNINGS = -Wall -Wno-pointer-sign -Wno-discarded-qualifiers -Werror
INCLUDES = -I. -I../include -I../include/smb2 -I../include/amiga_os
DEFINES = -DHAVE_CONFIG_H "-D_U_=__attribute__((unused))" -DNEED_POLL -DNEED_GETADDRINFO -DNEED_FREEADDRINFO -DNEED_GETLOGIN_R -DNEED_RANDOM -DNEED_SRANDOM
DEFINES = -DHAVE_CONFIG_H "-D_U_=__attribute__((unused))" -DNEED_POLL -DNEED_GETADDRINFO -DNEED_FREEADDRINFO -DNEED_GETLOGIN_R -DHAVE_LINGER -D__amigaos3__

CFLAGS = $(OPTIMIZE) $(DEBUG) $(WARNINGS) $(INCLUDES) $(DEFINES)

Expand Down
6 changes: 2 additions & 4 deletions lib/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
#endif

#if defined(__amigaos4__) || defined(__AMIGA__) || defined(__AROS__)
#define login_num ENXIO
#ifndef __amigaos4__
#define NEED_READV
#define NEED_WRITEV
Expand All @@ -65,19 +64,18 @@
#define write(fd, buf, count) send(fd, buf, count, 0)
#ifndef __AROS__
#define select(nfds, readfds, writefds, exceptfds, timeout) WaitSelect(nfds, readfds, writefds, exceptfds, timeout, NULL)
#define smb2_random rand
#define smb2_srandom srand
#endif
#ifdef libnix
StdFileDes *_lx_fhfromfd(int d) { return NULL; }
struct MinList __filelist = { (struct MinNode *) &__filelist.mlh_Tail, NULL, (struct MinNode *) &__filelist.mlh_Head };
#endif
#endif

#define login_num ENXIO

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <proto/exec.h>

#endif

Expand Down
56 changes: 48 additions & 8 deletions lib/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ int getlogin_r(char *buf, size_t size);
#endif /* __DREAMCAST__ */

#if defined(__amigaos4__) || defined(__AMIGA__) || defined(__AROS__)

#include <errno.h>
#include <sys/time.h>
#include <netinet/in.h>
Expand All @@ -327,10 +328,6 @@ int getlogin_r(char *buf, size_t size);
#include <sys/uio.h>
#endif
int getlogin_r(char *buf, size_t size);
#ifndef __AROS__
int random(void);
void srandom(unsigned int seed);
#endif
#if !defined(__amigaos4__) && (defined(__AMIGA__) || defined(__AROS__))
#include <proto/bsdsocket.h>
#undef HAVE_UNISTD_H
Expand All @@ -339,27 +336,48 @@ void srandom(unsigned int seed);
#undef freeaddrinfo
#endif
#define strncpy(a,b,c) strcpy(a,b)
#define getaddrinfo smb2_getaddrinfo
#define freeaddrinfo smb2_freeaddrinfo

#define POLLIN 0x0001 /* There is data to read */
#define POLLPRI 0x0002 /* There is urgent data to read */
#define POLLOUT 0x0004 /* Writing now will not block */
#define POLLERR 0x0008 /* Error condition */
#define POLLHUP 0x0010 /* Hung up */

struct pollfd {
int fd;
short events;
short revents;
};

#if !defined(__amigaos4__) && !defined(__amigaos3__) && !defined(__AROS__)

struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
int ai_family; /* PF_xxx */
int ai_socktype; /* SOCK_xxx */
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
size_t ai_addrlen; /* length of ai_addr */
char *ai_canonname; /* canonical name for hostname */
struct sockaddr *ai_addr; /* binary address */
struct addrinfo *ai_next; /* next structure in linked list */
};
#endif

int poll(struct pollfd *fds, unsigned int nfds, int timo);

int smb2_getaddrinfo(const char *node, const char*service,
const struct addrinfo *hints,
struct addrinfo **res);
void smb2_freeaddrinfo(struct addrinfo *res);

#define getaddrinfo smb2_getaddrinfo
#define freeaddrinfo smb2_freeaddrinfo

#ifndef __amigaos4__
ssize_t writev(t_socket fd, const struct iovec *iov, int iovcnt);
ssize_t readv(t_socket fd, const struct iovec *iov, int iovcnt);
ssize_t writev(int fd, const struct iovec *iov, int iovcnt);
ssize_t readv(int fd, const struct iovec *iov, int iovcnt);
#endif

#if !defined(HAVE_SOCKADDR_STORAGE)
/*
* RFC 2553: protocol-independent placeholder for socket addresses
Expand All @@ -369,6 +387,7 @@ ssize_t readv(t_socket fd, const struct iovec *iov, int iovcnt);
#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) * 2)
#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) * 2 - \
_SS_PAD1SIZE - _SS_ALIGNSIZE)

struct sockaddr_storage {
#ifdef HAVE_SOCKADDR_LEN
unsigned char ss_len; /* address length */
Expand All @@ -381,6 +400,27 @@ struct sockaddr_storage {
char __ss_pad2[_SS_PAD2SIZE];
};
#endif

#ifndef EAI_AGAIN
#define EAI_AGAIN EAGAIN
#endif

#ifndef EAI_FAIL
#define EAI_FAIL 4
#endif

#ifndef EAI_MEMORY
#define EAI_MEMORY 6
#endif

#ifndef EAI_NONAME
#define EAI_NONAME 8
#endif

#ifndef EAI_SERVICE
#define EAI_SERVICE 9
#endif

#endif

#ifdef __PS2__
Expand Down
7 changes: 3 additions & 4 deletions lib/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@
#include <stdint.h>
#endif

#include "portable-endian.h"
#include <errno.h>

#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
Expand All @@ -101,6 +98,8 @@
#include "libsmb2.h"
#include "smb3-seal.h"
#include "libsmb2-private.h"
#include "portable-endian.h"
#include <errno.h>

#define MAX_URL_SIZE 1024

Expand Down Expand Up @@ -857,7 +856,7 @@ set_nonblocking(t_socket fd)
#if defined(WIN32) || defined(_XBOX)
unsigned long opt = 1;
ioctlsocket(fd, FIONBIO, &opt);
#elif (defined(__AMIGA__) || defined(__AROS__)) && !defined(__amigaos4__)
#elif (defined(__AMIGA__) || defined(__AROS__)) && !defined(__amigaos4__) && !defined(__amigaos3__)
unsigned long opt = 0;
IoctlSocket(fd, FIONBIO, (char *)&opt);
#else
Expand Down

0 comments on commit 3ea8eed

Please sign in to comment.