Files
BMLFS/build-scripts/freeglut.build
2023-12-19 17:57:35 -06:00

80 lines
2.8 KiB
Bash

#! /bin/bash
# FreeGLUT
# Source: https://downloads.sourceforge.net/freeglut/freeglut-3.4.0.tar.gz
# GitHub: https://github.com/dcnieho/FreeGLUT.git
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: CMake, Mesa, libxkbcommon (GIT version req's it)
# Recommended: GLU
# Optional: libXi
# If optimizing, use these flags with GCC
export CFLAGS="-march=native -pipe "
export CFLAGS+="-O3 -ffat-lto-objects -flto=4 "
export LDFLAGS="-flto=4 -Wl,-O2 -Wl,--as-needed "
# Rebuild with -DFREEGLUT_GLES=ON to build freeglut library
# the glut libraries and glut.pc with GLES can be added to glut build
# Add CFLAGS & CXXFLAGS if building on system with out X11
export CFLAGS="-DEGL_NO_X11" CXXFLAGS="-DEGL_NO_X11"
mkdir build &&
cd build &&
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DFREEGLUT_BUILD_DEMOS=OFF \
-DFREEGLUT_BUILD_STATIC_LIBS=OFF \
-DFREEGLUT_GLES=OFF \
-DFREEGLUT_WAYLAND=ON \
-Wno-dev .. &&
read -p "Compile?" && make -j2 &&
cd -
mkdir build-gles && cd build-gles &&
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DFREEGLUT_BUILD_DEMOS=OFF \
-DFREEGLUT_BUILD_STATIC_LIBS=OFF \
-DFREEGLUT_GLES=ON \
-DFREEGLUT_WAYLAND=ON \
-Wno-dev .. && \
make -j2 &&
cd build &&
sudo -S make DESTDIR=$BUILD install && \
sudo -S mkdir -pv ${BUILD}/usr/lib/pkgconfig/ && \
sudo cp -a freeglut.pc ${BUILD}/usr/lib/pkgconfig/ && \
cd build-gles &&
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------------------------------------------------------|
freeglut: freeglut (alternative GLUT library)
freeglut:
freeglut: freeglut is a completely OpenSourced alternative to the OpenGL
freeglut: Utility Toolkit (GLUT) library. GLUT (and hence freeglut) allows
freeglut: the user to create and manage windows containing OpenGL contexts
freeglut: on a wide range of platforms and also read the mouse, keyboard, and
freeglut: joystick functions.
freeglut:
freeglut: Homepage: http://freeglut.sourceforge.net/
freeglut:
freeglut:
EOF
sudo -S mv -v /tmp/slack-desc install/ &&
sudo -S makepkg -l y -c n $PKGS/freeglut-3.4.0-$PSUFFIX &&
sudo -S rm -rf ${BUILD}/*