Skip to content

Commit

Permalink
Merge pull request #383 from Wolf3s/ci-fixes
Browse files Browse the repository at this point in the history
Build fixes for CI and other non Ci platforms
  • Loading branch information
sahlberg authored Dec 15, 2024
2 parents ce73a29 + 98405f0 commit c84927a
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 55 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,27 @@ jobs:
build-ps4:
name: PS4

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

- name: Create Build Environment
run: >
sudo apt update &&
sudo apt 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
run: |
sudo apt-get update && \
sudo apt-get install -y pacman-package-manager wget cmake git gettext smpq && \
sudo tee -a /etc/pacman.conf > /dev/null <<TEXT
[pacbrew]
SigLevel = Optional TrustAll
Server = https://pacman.mydedibox.fr/pacbrew/packages/
TEXT
- name: Setup pacman packages
run: |
sudo pacman --noconfirm -Sy && sudo pacman --noconfirm -S ps4-openorbis ps4-openorbis-portlibs
- name: build libsmb2
run: |
make -f Makefile.platform ps4_all clean
Expand Down
45 changes: 22 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ if(NOT ESP_PLATFORM)
if(NOT IOP AND BUILD_IRX)
project(smb2man
LANGUAGES C
VERSION 2.2.0
VERSION 2.3.0
)
set(VERSION 2.2.0)
set(VERSION 2.3.0)
set(PACKAGE "smb2man")
set(PACKAGE_BUGREPORT "[email protected] or [email protected]")
set(PACKAGE_NAME "smb2man")
Expand All @@ -43,23 +43,22 @@ if(NOT ESP_PLATFORM)
configure_file(libsmb2.pc.in libsmb2.pc @ONLY)
endif()


if(NOT PICO_BOARD AND NOT ESP_PLATFORM)
set(SOVERSION 1 CACHE STRING "" FORCE)
if(NOT IOP AND NOT BUILD_IRX)
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "Installation directory for libraries")
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
set(INSTALL_CMAKE_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/cmake/libsmb2" CACHE PATH "Installation directory for cmake (.cmake) files")
endif()
if(CMAKE_SYSTEM_NAME MATCHES NintendoSwitch OR CMAKE_SYSTEM_NAME MATCHES Nintendo3DS OR PS4 OR PS2 OR VITA OR CMAKE_SYSTEM_NAME MATCHES Dreamcast OR CMAKE_SYSTEM_NAME MATCHES NintendoGameCube OR CMAKE_SYSTEM_NAME MATCHES NintendoDS OR CMAKE_SYSTEM_NAME MATCHES NintendoWii OR CMAKE_SYSTEM_NAME MATCHES CafeOS)
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
else()
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
endif()
option(ENABLE_EXAMPLES "Build example programs" OFF)
if(NOT ESP_PLATFORM)
set(SOVERSION 1 CACHE STRING "" FORCE)
if(NOT IOP AND NOT BUILD_IRX)
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "Installation directory for libraries")
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
set(INSTALL_CMAKE_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/cmake/libsmb2" CACHE PATH "Installation directory for cmake (.cmake) files")
endif()
if(CMAKE_SYSTEM_NAME MATCHES NintendoSwitch OR CMAKE_SYSTEM_NAME MATCHES Nintendo3DS OR PS4 OR PS2 OR VITA OR CMAKE_SYSTEM_NAME MATCHES Dreamcast OR CMAKE_SYSTEM_NAME MATCHES NintendoGameCube OR CMAKE_SYSTEM_NAME MATCHES NintendoDS OR CMAKE_SYSTEM_NAME MATCHES NintendoWii OR CMAKE_SYSTEM_NAME MATCHES CafeOS)
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
else()
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
endif()
option(ENABLE_EXAMPLES "Build example programs" OFF)

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
endif()

if(CMAKE_SYSTEM_NAME MATCHES Linux)
Expand All @@ -68,7 +67,7 @@ endif()
find_package(GSSAPI)
endif()

if(NOT PICO_BOARD AND NOT ESP_PLATFORM)
if(NOT ESP_PLATFORM)
include(cmake/ConfigureChecks.cmake)
endif()

Expand Down Expand Up @@ -119,20 +118,20 @@ endif()
set(ARCH "-march=armv8-a -mtp=soft -fPIE")
set(CMAKE_C_FLAGS "-g -Wall -O2 -ffast-math ${ARCH}")
set(CMAKE_C_FLAGS "-Wno-unused-variable")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -std=gnu++11")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -std=gnu11")
set(CMAKE_C_LDFLAGS "${CMAKE_C_FLAGS} -specs=switch.specs -g ${ARCH} -Wl,-Map,$(notdir $*.map)")
add_compile_options("${CMAKE_C_FLAGS} ${CMAKE_LDFLAGS}")
elseif(CMAKE_SYSTEM_NAME MATCHES Nintendo3DS)
add_definitions(-DARM11 -D_3DS -D__3DS__ -DNEED_READV -DNEED_WRITEV -DNEED_GETLOGIN_R)
set(ARCH "-march=armv6k -mfloat-abi=hard -mtune=mpcore -mtp=soft -fPIE")
set(CMAKE_C_FLAGS "-Wno-unused-variable -g -Wall -O2 -mword-relocations -fomit-frame-pointer -ffast-math ${ARCH}")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -fno-exceptions -std=gnu++11")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -fno-exceptions -std=gnu11")
set(CMAKE_C_LDFLAGS "${CMAKE_C_FLAGS} -specs=3dsx.specs -g ${ARCH} -Wl,-Map,$(notdir $*.map)")
add_compile_options("${CMAKE_C_FLAGS} ${CMAKE_LDFLAGS}")
elseif(CMAKE_SYSTEM_NAME MATCHES NintendoDS)
add_definitions(-DARM9 -D__NDS__ -DNEED_READV -DNEED_WRITEV -DNEED_GETLOGIN_R -DNEED_GETADDRINFO -DNEED_FREEADDRINFO -DNEED_POLL)
add_definitions(-DARM9 -D__NDS__ -DNEED_READV -DHAVE_SOCKADDR_STORAGE -DNEED_WRITEV -DNEED_GETLOGIN_R -DNEED_GETADDRINFO -DNEED_FREEADDRINFO -DNEED_POLL)
set(CMAKE_C_FLAGS "-Wno-format -Wpointer-arith")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -fno-exceptions -std=gnu++11")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -fno-exceptions -std=gnu11")
set(CMAKE_C_LDFLAGS "${CMAKE_C_FLAGS} -specs=ds_arm9.specs -g")
add_compile_options("${CMAKE_C_FLAGS} ${CMAKE_LDFLAGS}")
elseif(CMAKE_SYSTEM_NAME MATCHES NintendoGameCube)
Expand Down
2 changes: 1 addition & 1 deletion Xbox 360/libsmb2.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@
<ClCompile Include="..\lib\compat.c" />
<ClCompile Include="..\lib\dcerpc-lsa.c" />
<ClCompile Include="..\lib\dcerpc-srvsvc.c" />
<ClCompile Include="..\lib\dcerpc.c" />
<ClCompile Include="..\lib\errors.c" />
<ClCompile Include="..\lib\hmac-md5.c" />
<ClCompile Include="..\lib\hmac.c" />
Expand All @@ -300,6 +299,7 @@
<ClCompile Include="..\lib\smb2-cmd-lock.c" />
<ClCompile Include="..\lib\smb2-cmd-logoff.c" />
<ClCompile Include="..\lib\smb2-cmd-negotiate.c" />
<ClCompile Include="..\lib\smb2-cmd-notify-change.c" />
<ClCompile Include="..\lib\smb2-cmd-query-directory.c" />
<ClCompile Include="..\lib\smb2-cmd-query-info.c" />
<ClCompile Include="..\lib\smb2-cmd-read.c" />
Expand Down
6 changes: 3 additions & 3 deletions Xbox 360/libsmb2.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,6 @@
<ClCompile Include="..\lib\compat.c">
<Filter>lib</Filter>
</ClCompile>
<ClCompile Include="..\lib\dcerpc.c">
<Filter>lib</Filter>
</ClCompile>
<ClCompile Include="..\lib\dcerpc-lsa.c">
<Filter>lib</Filter>
</ClCompile>
Expand Down Expand Up @@ -264,5 +261,8 @@
<ClCompile Include="..\lib\smb2-cmd-lock.c">
<Filter>lib</Filter>
</ClCompile>
<ClCompile Include="..\lib\smb2-cmd-notify-change.c">
<Filter>lib</Filter>
</ClCompile>
</ItemGroup>
</Project>
10 changes: 5 additions & 5 deletions Xbox/libsmb2.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
WarnAsError="TRUE"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="3"
CompileAs="1"/>
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Expand Down Expand Up @@ -140,7 +140,7 @@
WarnAsError="TRUE"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="3"
CompileAs="1"/>
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Expand Down Expand Up @@ -279,9 +279,6 @@
<File
RelativePath="..\lib\dcerpc-srvsvc.c">
</File>
<File
RelativePath="..\lib\dcerpc.c">
</File>
<File
RelativePath="..\lib\errors.c">
</File>
Expand Down Expand Up @@ -369,6 +366,9 @@
<File
RelativePath="..\lib\smb2-cmd-negotiate.c">
</File>
<File
RelativePath="..\lib\smb2-cmd-notify-change.c">
</File>
<File
RelativePath="..\lib\smb2-cmd-query-directory.c">
</File>
Expand Down
9 changes: 5 additions & 4 deletions lib/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -634,13 +634,15 @@ struct iovec {
#ifndef __NDS__
#include <network.h>
#endif
#if !defined(HAVE_SOCKADDR_STORAGE)
struct sockaddr_storage {
#ifdef HAVE_SOCKADDR_SA_LEN
unsigned char ss_len;
#endif /* HAVE_SOCKADDR_SA_LEN */
unsigned char ss_family;
unsigned char fill[127];
};
#endif

struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
Expand All @@ -653,10 +655,6 @@ struct addrinfo {
struct addrinfo *ai_next; /* next structure in linked list */
};

#ifdef __NDS__
typedef int socklen_t;
#endif

#endif
#define sockaddr_in6 sockaddr_in
#else
Expand Down Expand Up @@ -732,6 +730,9 @@ void smb2_freeaddrinfo(struct addrinfo *res);
#define setsockopt net_setsockopt
s32 getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen);
#define select net_select
#define accept net_accept
#define listen net_listen
#define bind net_bind
#endif

struct pollfd {
Expand Down
3 changes: 2 additions & 1 deletion lib/ntlmssp.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ struct auth_data {
void
hex_print(const char *blurb, uint8_t *data, int len)
{
int i;
printf("%s\n", blurb);
for (int i = 0; i < len; i++) {
for (i = 0; i < len; i++) {
printf("%02X ", data[i]);
if (!((i + 1) & 0xf)) {
printf("\n");
Expand Down
2 changes: 2 additions & 0 deletions lib/ps2/imports.lst
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,6 @@ sysclib_IMPORTS_end

stdio_IMPORTS_start
I_printf
I_putchar
I_puts
stdio_IMPORTS_end
2 changes: 1 addition & 1 deletion lib/smb2-cmd-create.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ int
smb2_process_create_request_variable(struct smb2_context *smb2,
struct smb2_pdu *pdu)
{
struct smb2_create_request *req = (struct smb2_create_request*)pdu->payload;;
struct smb2_create_request *req = (struct smb2_create_request*)pdu->payload;
struct smb2_iovec *iov = &smb2->in.iov[smb2->in.niov - 1];
uint32_t offset;
void *ptr;
Expand Down
9 changes: 4 additions & 5 deletions lib/smb2-cmd-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,10 @@ smb2_process_ioctl_request_variable(struct smb2_context *smb2,
struct smb2_iovec *iov = &smb2->in.iov[smb2->in.niov - 1];
struct smb2_iovec vec;
void *ptr = NULL;
struct smb2_ioctl_validate_negotiate_info *info;
/* this one is handled locally regardless of proxy or not */
ptr = smb2_alloc_init(smb2, sizeof(struct smb2_ioctl_validate_negotiate_info));
info = ptr;

if (req->input_count > iov->len - IOVREQ_OFFSET) {
return -EINVAL;
Expand All @@ -397,11 +401,6 @@ smb2_process_ioctl_request_variable(struct smb2_context *smb2,

switch (req->ctl_code) {
case SMB2_FSCTL_VALIDATE_NEGOTIATE_INFO:
/* this one is handled locally regardless of proxy or not */
ptr = smb2_alloc_init(smb2,
sizeof(struct smb2_ioctl_validate_negotiate_info));
struct smb2_ioctl_validate_negotiate_info *info = ptr;

smb2_get_uint32(&vec, 0, &info->capabilities);
memcpy(info->guid, &vec.buf[4], 16);
smb2_get_uint16(&vec, 20, &info->security_mode);
Expand Down
3 changes: 2 additions & 1 deletion lib/smb2-cmd-read.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,12 @@ smb2_process_read_fixed(struct smb2_context *smb2,
}

static void free_read_reply(struct smb2_context *smb2, void * payload) {
struct smb2_read_reply *rep;
if (payload == NULL) {
return;
}

struct smb2_read_reply *rep = (struct smb2_read_reply*)payload;
rep = (struct smb2_read_reply*)payload;
if (rep->data_length != 0 && rep->data != NULL) {
free(rep->data);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/smb2-data-file-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,12 @@ smb2_decode_file_network_open_info(struct smb2_context *smb2,
struct smb2_file_network_open_info *fs,
struct smb2_iovec *vec)
{
if (vec->len < 56) {
uint64_t t;

if (vec->len < 56) {
return -1;
}

uint64_t t;

smb2_get_uint64(vec, 0, &t);
smb2_win_to_timeval(t, &fs->creation_time);

Expand Down

0 comments on commit c84927a

Please sign in to comment.