#! /bin/bash # SDL2 # Source: https://www.libsdl.org/release/SDL2-2.28.5.tar.gz # # $BUILD = Directory to temporarily install # $PKGS = Directory to store built packages # # DEPS # Required: NONE # Recommended: NONE # Optional: ALSA Doxygen iBus NASM PulseAudio libsamplerate libsndio # Optinal: XOrg, DirectFB, fcitx, pipewire # If optimizing, use these flags export CFLAGS="-march=native -mtune=native -pipe " export CFLAGS+="-O3 -Ofast -falign-functions=32 -ffat-lto-objects " export CFLAGS+="-flto=auto -fno-semantic-interposition -fstack-protector-strong " export CFLAGS+="-fzero-call-used-regs=used -mprefer-vector-width=256" export CXXFLAGS=$CFLAGS export LDFLAGS="-flto=4 -Wl,-O2 -Wl,--as-needed" #patch -Np1 -i ../patches/sdl2-alpine/0001-src-video-directfb-SDL_DirectFB_render.c-fix-build.patch #patch -Np1 -i ../patches/sdl2-alpine/directfb-cflags.patch #patch -Np1 -i ../patches/sdl2-alpine/khronos.patch mkdir BUILD && cd BUILD && # NOTE: If Xorg libraries are not installed in /usr, add this option: # -DCMAKE_SYSTEM_PREFIX_PATH=/opt/Xorg cmake -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_LIBDIR=lib \ -DCMAKE_BUILD_TYPE=None \ -DBUILD_SHARED_LIBS=True \ -DCMAKE_SYSTEM_NAME=Linux \ -DCMAKE_HOST_SYSTEM_NAME=Linux \ -DSDL_TEST=OFF \ -DALSA=ON \ -DJACK=OFF \ -DCLOCK_GETTIME=ON \ -DARTS=OFF \ -DESD=OFF \ -DNAS=OFF \ -DRPATH=OFF \ -DSDL_X11=ON \ -DSDL_X11_XINPUT=ON \ -DVIDEO_DIRECTFB=OFF \ -DVIDEO_WAYLAND=ON \ -DCMAKE_C_FLAGS="$CFLAGS" \ -DSDL_STATIC=ON \ -DSDL_SHARED=ON \ -DPULSEAUDIO_SHARED=ON .. && read -p "Compile?" && make -j2 && sudo -S make DESTDIR=$BUILD install && cd $BUILD && sudo -S mkdir -v ${BUILD}/install && cat > /tmp/slack-desc << "EOF" # HOW TO EDIT THIS FILE: # The "handy ruler" below makes it easier to edit a package description. Line # up the first '|' above the ':' following the base package name, and the '|' # on the right side marks the last column you can put a character in. You must # make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':' except on otherwise blank lines. |-----handy-ruler------------------------------------------------------| SDL2: SDL2 (Simple DirectMedia Layer Version 2) SDL2: SDL2: Simple DirectMedia Layer is a cross-platform development library SDL2: designed to provide low-level access to audio, keyboard, mouse, SDL2: joystick, and graphics hardware ia via OpenGL. It is used by SDL2: video playback software, emulators, and games. SDL2: SDL2: Homepage: http://www.libsdl.org SDL2: SDL2: SDL2: EOF sudo -S mv -v /tmp/slack-desc install/ && sudo -S makepkg -l y -c n $PKGS/SDL2-2.28.5-$PSUFFIX && sudo -S rm -rf ${BUILD}/*