From f80f4030c244c1b65283ad82660379ff0b371e8d Mon Sep 17 00:00:00 2001 From: turbocat Date: Tue, 1 Jun 2021 18:16:52 +0000 Subject: [PATCH] SDL: - Can be compiled as a PE DLL git-svn-id: svn://kolibrios.org@8758 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../sdk/sources/SDL-1.2.2_newlib/src/Makefile | 24 +- .../sdk/sources/SDL-1.2.2_newlib/src/dll.lds | 118 +++++++++ .../sources/SDL-1.2.2_newlib/src/libSDL.def | 226 ++++++++++++++++++ 3 files changed, 361 insertions(+), 7 deletions(-) create mode 100644 contrib/sdk/sources/SDL-1.2.2_newlib/src/dll.lds create mode 100644 contrib/sdk/sources/SDL-1.2.2_newlib/src/libSDL.def diff --git a/contrib/sdk/sources/SDL-1.2.2_newlib/src/Makefile b/contrib/sdk/sources/SDL-1.2.2_newlib/src/Makefile index f351d5f2e6..f34500dbe4 100755 --- a/contrib/sdk/sources/SDL-1.2.2_newlib/src/Makefile +++ b/contrib/sdk/sources/SDL-1.2.2_newlib/src/Makefile @@ -1,10 +1,15 @@ CC = kos32-gcc AR = kos32-ar +LD = kos32-ld +STRIP = kos32-strip -LIBNAME=libSDLn.a +LIBNAME=libSDL SDK_DIR:= $(abspath ../../..) - + +LDFLAGS+= -shared -s -T dll.lds --entry _DllStartup --image-base=0 --out-implib $(LIBNAME).dll.a +LDFLAGS+= -L/home/max/autobuild/tools/win32/mingw32/lib + endian_OBJS = endian/SDL_endian.o file_OBJS = file/SDL_rwops.o @@ -40,15 +45,20 @@ CFLAGS = -c -O2 -D_REENTRANT -I../include -I SYSCALL/include -I. -DPACKAGE=\"SDL -D__KOLIBRIOS__ -DDEBUG_VIDEO -UWIN32 -U_Win32 -U_WIN32 -U__MINGW32__ \ -I../../newlib/libc/include/ -all: $(LIBNAME) - +all: $(LIBNAME).dll $(LIBNAME).a + install: $(LIBNAME) mv -f $(LIBNAME) $(SDK_DIR)/lib -$(LIBNAME): $(OBJS) +$(LIBNAME).a: $(OBJS) $(MAKE) -C SYSCALL/src - $(AR) -crs $(LIBNAME) $(OBJS) SYSCALL/src/os.o - + $(AR) -crs $(LIBNAME).a $(OBJS) SYSCALL/src/os.o + +$(LIBNAME).dll: libSDL.def $(OBJS) + $(LD) $(LDFLAGS) -o $@ libSDL.def $(OBJS) SYSCALL/src/os.o $(LIBS) -ldll -lsound -lc.dll + $(STRIP) $@ + + %.o : %.asm Makefile nasm -f coff $< diff --git a/contrib/sdk/sources/SDL-1.2.2_newlib/src/dll.lds b/contrib/sdk/sources/SDL-1.2.2_newlib/src/dll.lds new file mode 100644 index 0000000000..786c69ca8e --- /dev/null +++ b/contrib/sdk/sources/SDL-1.2.2_newlib/src/dll.lds @@ -0,0 +1,118 @@ + +OUTPUT_FORMAT(pei-i386) + +SECTIONS +{ + + . = SIZEOF_HEADERS; + . = ALIGN(__section_alignment__); + + .text __image_base__ + . : + { + *(.text) + *(SORT(.text$*)) + *(.text.*) + *(.gnu.linkonce.t.*) + *(.glue_7t) + *(.glue_7) + ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; + LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*)); LONG (0); + ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; + LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*)); LONG (0); + *(.fini) + + . = ALIGN(16) ; + ___crt_xc_start__ = . ; + *(SORT(.CRT$XC*)) /* C initialization */ + ___crt_xc_end__ = . ; + ___crt_xi_start__ = . ; + *(SORT(.CRT$XI*)) /* C++ initialization */ + ___crt_xi_end__ = . ; + ___crt_xl_start__ = . ; + *(SORT(.CRT$XL*)) /* TLS callbacks */ + /* ___crt_xl_end__ is defined in the TLS Directory support code */ + ___crt_xp_start__ = . ; + *(SORT(.CRT$XP*)) /* Pre-termination */ + ___crt_xp_end__ = . ; + ___crt_xt_start__ = . ; + *(SORT(.CRT$XT*)) /* Termination */ + ___crt_xt_end__ = . ; + + . = ALIGN(16) ; + + *(.rdata) + *(SORT(.rdata$*)) + __rt_psrelocs_start = .; + *(.rdata_runtime_pseudo_reloc) + __rt_psrelocs_end = .; + } + __rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start; + ___RUNTIME_PSEUDO_RELOC_LIST_END__ = .; + __RUNTIME_PSEUDO_RELOC_LIST_END__ = .; + ___RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size; + __RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size; + + .data ALIGN(__section_alignment__): + { + PROVIDE ( __data_start__ = .) ; + *(.data) + *(.data2) + *(SORT(.data$*)) + *(.jcr) + __CRT_MT = .; + LONG(0); + PROVIDE ( __data_end__ = .) ; + *(.data_cygwin_nocopy) + } + + .bss ALIGN(__section_alignment__): + { + __bss_start__ = . ; + *(.bss) + *(COMMON) + __bss_end__ = . ; + } + + .edata ALIGN(__section_alignment__): + { + *(.edata) + } + + /DISCARD/ : + { + *(.debug$S) + *(.debug$T) + *(.debug$F) + *(.drectve) + *(.note.GNU-stack) + *(.eh_frame) + *(.comment) + *(.debug_abbrev) + *(.debug_info) + *(.debug_line) + *(.debug_frame) + *(.debug_loc) + *(.debug_pubnames) + *(.debug_aranges) + *(.debug_ranges) + } + + .idata ALIGN(__section_alignment__): + { + SORT(*)(.idata$2) + SORT(*)(.idata$3) + /* These zeroes mark the end of the import list. */ + LONG (0); LONG (0); LONG (0); LONG (0); LONG (0); + SORT(*)(.idata$4) + SORT(*)(.idata$5) + SORT(*)(.idata$6) + SORT(*)(.idata$7) + } + + .reloc ALIGN(__section_alignment__) : + { + *(.reloc) + } + +} + diff --git a/contrib/sdk/sources/SDL-1.2.2_newlib/src/libSDL.def b/contrib/sdk/sources/SDL-1.2.2_newlib/src/libSDL.def new file mode 100644 index 0000000000..e1e9169b72 --- /dev/null +++ b/contrib/sdk/sources/SDL-1.2.2_newlib/src/libSDL.def @@ -0,0 +1,226 @@ +EXPORTS +SDL_ReadBE16 +SDL_ReadBE32 +SDL_ReadBE64 +SDL_ReadLE16 +SDL_ReadLE32 +SDL_ReadLE64 +SDL_WriteBE16 +SDL_WriteBE32 +SDL_WriteBE64 +SDL_WriteLE16 +SDL_WriteLE32 +SDL_WriteLE64 +SDL_AllocRW +SDL_FreeRW +SDL_RWFromFile +SDL_RWFromFP +SDL_RWFromMem +SDL_CondBroadcast +SDL_CondSignal +SDL_CondWait +SDL_CondWaitTimeout +SDL_CreateCond +SDL_DestroyCond +SDL_CreateMutex +SDL_DestroyMutex +SDL_mutexP +SDL_mutexV +SDL_CreateSemaphore +SDL_DestroySemaphore +SDL_SemPost +SDL_SemTryWait +SDL_SemValue +SDL_SemWait +SDL_SemWaitTimeout +SDL_SYS_CreateThread +SDL_SYS_KillThread +SDL_SYS_SetupThread +SDL_SYS_WaitThread +SDL_ThreadID +SDL_CreateThread +SDL_GetErrBuf +SDL_GetThreadID +SDL_KillThread +SDL_RunThread +SDL_ThreadsInit +SDL_ThreadsQuit +SDL_WaitThread +SDL_AddTimer +SDL_RemoveTimer +SDL_SetTimer +SDL_SetTimerThreaded +SDL_ThreadedTimerCheck +SDL_TimerInit +SDL_TimerQuit +SDL_Delay +SDL_GetTicks +SDL_StartTicks +SDL_SYS_StartTimer +SDL_SYS_StopTimer +SDL_SYS_TimerInit +SDL_SYS_TimerQuit +SDL_AppActiveInit +SDL_GetAppState +SDL_PrivateAppActive +SDL_EventState +SDL_EventThreadID +SDL_GetEventFilter +SDL_Lock_EventThread +SDL_PeepEvents +SDL_PollEvent +SDL_PrivateSysWMEvent +SDL_PumpEvents +SDL_PushEvent +SDL_SetEventFilter +SDL_StartEventLoop +SDL_StopEventLoop +SDL_Unlock_EventThread +SDL_WaitEvent +SDL_PrivateExpose +SDL_CheckKeyRepeat +SDL_EnableKeyRepeat +SDL_EnableUNICODE +SDL_GetKeyName +SDL_GetKeyState +SDL_GetModState +SDL_KeyboardInit +SDL_PrivateKeyboard +SDL_ResetKeyboard +SDL_SetModState +SDL_GetMouseState +SDL_GetRelativeMouseState +SDL_MouseInit +SDL_PrivateMouseButton +SDL_PrivateMouseMotion +SDL_PrivateQuit +SDL_QuitInit +SDL_PrivateResize +SDL_CalculateBlit0 +SDL_CalculateBlit1 +SDL_CalculateAlphaBlit +SDL_CalculateBlit +SDL_CalculateBlitN +SDL_LoadBMP_RW +SDL_SaveBMP_RW +SDL_CreateCursor +SDL_CursorInit +SDL_CursorPaletteChanged +SDL_CursorQuit +SDL_DrawCursor +SDL_DrawCursorNoLock +SDL_EraseCursor +SDL_EraseCursorNoLock +SDL_FreeCursor +SDL_GetCursor +SDL_MouseRect +SDL_MoveCursor +SDL_ResetCursor +SDL_SetCursor +SDL_ShowCursor +SDL_WarpMouse +SDL_GetGamma +SDL_GetGammaRamp +SDL_SetGamma +SDL_SetGammaRamp +SDL_AllocBlitMap +SDL_AllocFormat +SDL_ApplyGamma +SDL_CalculatePitch +SDL_DitherColors +SDL_FindColor +SDL_FormatChanged +SDL_FreeBlitMap +SDL_FreeFormat +SDL_GetRGB +SDL_GetRGBA +SDL_InvalidateMap +SDL_MapRGB +SDL_MapRGBA +SDL_MapSurface +SDL_ReallocFormat +SDL_RLEAlphaBlit +SDL_RLEBlit +SDL_RLESurface +SDL_UnRLESurface +SDL_SoftStretch +SDL_ConvertSurface +SDL_CreateRGBSurface +SDL_CreateRGBSurfaceFrom +SDL_FillRect +SDL_FreeSurface +SDL_GetClipRect +SDL_LockSurface +SDL_LowerBlit +SDL_SetAlpha +SDL_SetClipRect +SDL_SetColorKey +SDL_UnlockSurface +SDL_UpperBlit +SDL_DisplayFormat +SDL_DisplayFormatAlpha +SDL_Flip +SDL_GetVideoInfo +SDL_GetVideoSurface +SDL_GetWMInfo +SDL_GL_GetAttribute +SDL_GL_GetProcAddress +SDL_GL_LoadLibrary +SDL_GL_Lock +SDL_GL_SetAttribute +SDL_GL_SwapBuffers +SDL_GL_Unlock +SDL_GL_UpdateRects +SDL_GL_UpdateRectsLock +SDL_ListModes +SDL_SetColors +SDL_SetPalette +SDL_SetVideoMode +SDL_UpdateRect +SDL_UpdateRects +SDL_VideoDriverName +SDL_VideoInit +SDL_VideoModeOK +SDL_VideoQuit +SDL_WM_GetCaption +SDL_WM_GrabInput +SDL_WM_IconifyWindow +SDL_WM_SetCaption +SDL_WM_SetIcon +SDL_WM_ToggleFullScreen +SDL_CreateYUVOverlay +SDL_DisplayYUVOverlay +SDL_FreeYUVOverlay +SDL_LockYUVOverlay +SDL_UnlockYUVOverlay +SDL_CreateYUV_SW +SDL_DisplayYUV_SW +SDL_FreeYUV_SW +SDL_LockYUV_SW +SDL_UnlockYUV_SW +SDL_Init +SDL_InitSubSystem +SDL_Linked_Version +SDL_Quit +SDL_QuitSubSystem +SDL_WasInit +SDL_ClearError +SDL_Error +SDL_GetError +SDL_GetErrorMsg +SDL_GetErrorMsgUNICODE +SDL_printf +SDL_SetError +SDL_InstallParachute +SDL_printf_error +SDL_UninstallParachute +SDL_getenv +SDL_putenv +SDL_AudioDriverName +SDL_AudioInit +SDL_AudioQuit +SDL_CloseAudio +SDL_LockAudio +SDL_OpenAudio +SDL_PauseAudio +SDL_UnlockAudio