Ticket #7970: 7970-hdhr_mingw.patch

File 7970-hdhr_mingw.patch, 2.4 KB (added by Jeff Lu <jll544@…>, 14 years ago)

Additional patch required for MinGW compilation.

  • libs\libmythhdhomerun\hdhomerun_os_windows.h

    old new  
    3131 */
    3232
    3333#define _WINSOCKAPI_
     34#if defined(USING_MINGW)
     35/* MinGW lacks wspiapi.h; set minimum WINVER to WinXP to remove dependency */
     36#define WINVER 0x0501
     37#endif
    3438#include <windows.h>
    3539#include <winsock2.h>
    3640#include <ws2tcpip.h>
     41#if !defined(USING_MINGW)
    3742#include <wspiapi.h>
     43#endif
    3844#include <stdlib.h>
    3945#include <stdio.h>
    4046#include <stdarg.h>
     
    5359#endif
    5460
    5561typedef int bool_t;
     62#if defined(USING_MINGW)
     63#include <stdint.h>
     64#include <pthread.h>
     65#else
    5666typedef signed __int8 int8_t;
    5767typedef signed __int16 int16_t;
    5868typedef signed __int32 int32_t;
     
    6373typedef unsigned __int64 uint64_t;
    6474typedef HANDLE pthread_t;
    6575typedef HANDLE pthread_mutex_t;
     76#endif
    6677
    6778#define va_copy(x, y) x = y
    6879#define atoll _atoi64
     
    8293extern LIBTYPE void msleep_approx(uint64_t ms);
    8394extern LIBTYPE void msleep_minimum(uint64_t ms);
    8495
     96#if !defined(PTHREAD_H)
    8597extern LIBTYPE int pthread_create(pthread_t *tid, void *attr, LPTHREAD_START_ROUTINE start, void *arg);
    8698extern LIBTYPE int pthread_join(pthread_t tid, void **value_ptr);
    8799extern LIBTYPE void pthread_mutex_init(pthread_mutex_t *mutex, void *attr);
    88100extern LIBTYPE void pthread_mutex_lock(pthread_mutex_t *mutex);
    89101extern LIBTYPE void pthread_mutex_unlock(pthread_mutex_t *mutex);
     102#endif
    90103
    91104/*
    92105 * The console output format should be set to UTF-8, however in XP and Vista this breaks batch file processing.
  • libs\libmythhdhomerun\hdhomerun_os_windows.c

    old new  
    7676        }
    7777}
    7878
     79#if !defined(PTHREAD_H)
    7980int pthread_create(pthread_t *tid, void *attr, LPTHREAD_START_ROUTINE start, void *arg)
    8081{
    8182        *tid = CreateThread(NULL, 0, start, arg, 0, NULL);
     
    112113{
    113114        ReleaseMutex(*mutex);
    114115}
     116#endif
    115117
    116118/*
    117119 * The console output format should be set to UTF-8, however in XP and Vista this breaks batch file processing.
  • libs\libmythhdhomerun\libmythhdhomerun.pro

    old new  
    3232mingw {
    3333    HEADERS += hdhomerun_os_windows.h
    3434    SOURCES += hdhomerun_os_windows.c
     35    SOURCES -= hdhomerun_os_posix.c
    3536    SOURCES += hdhomerun_sock_windows.c
    3637    LIBS += -lws2_32 -liphlpapi -lpthread
    3738}