Skip to content

Instantly share code, notes, and snippets.

@jacksonrayhamilton
Last active August 29, 2017 03:37
Show Gist options
  • Save jacksonrayhamilton/d0742799bc04320a49ff296533bdf4e6 to your computer and use it in GitHub Desktop.
Save jacksonrayhamilton/d0742799bc04320a49ff296533bdf4e6 to your computer and use it in GitHub Desktop.
Install GNUstep on Debian 8 (with libobjc2)
# This is a template makefile for use with GNUstep make.
# After running it, your program should be executable like so:
#
# ./obj/Main
include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME = Main
Main_OBJC_FILES = main.m # Add additional sources here.
Main_OBJCFLAGS = -fobjc-arc
include $(GNUSTEP_MAKEFILES)/tool.make
#!/usr/bin/env bash
# It seems that many modern Objective-C features aren't available without
# libobjc2, which doesn't seem to be available as a Debian package. Also,
# compiling and using it alongside the Debian GNUstep packages doesn't work too
# well (it seems like they may each provide their own definition of the Protocol
# and Object classes). Basically, to get a fully-functioning Objective-C
# compilation environment on Debian 8, run this script.
# Please ensure any Debian GNUstep packages are uninstalled before running this
# script.
# Slightly adapted from
# http://wiki.gnustep.org/index.php/GNUstep_under_Ubuntu_Linux for Debian 8.
# Also, uses the latest stable versions of source packages as of this writing
# (hopefully to improve reproducability of success; but feel free to upgrade
# them if you want).
# If this script is successful, you should be able to compile a "main.m" program
# by running "make" in a directory with a "GNUmakefile" with these contents:
#
# include $(GNUSTEP_MAKEFILES)/common.make
# TOOL_NAME = Main
# Main_OBJC_FILES = main.m
# include $(GNUSTEP_MAKEFILES)/tool.make
# Show prompt function
function showPrompt()
{
if [ "$PROMPT" = true ] ; then
echo -e "\n\n"
read -p "${GREEN}Press enter to continue...${NC}"
fi
}
# Set colors
GREEN=`tput setaf 2`
NC=`tput sgr0` # No Color
# Set to true to pause after each build to verify successful build and installation
PROMPT=true
# Install Requirements
sudo apt update
echo -e "\n\n${GREEN}Installing dependencies...${NC}"
sudo apt -y install clang ninja cmake libffi-dev libxml2-dev \
libgnutls28-dev libicu-dev libblocksruntime-dev libkqueue-dev libpthread-workqueue-dev autoconf libtool \
libjpeg-dev libtiff5-dev libffi-dev libcairo2-dev libx11-dev libxt-dev libxft-dev \
llvm-dev libdispatch-dev
# https://bugs.launchpad.net/ubuntu/+source/llvm/+bug/1387011/comments/17
wget -qO- https://launchpadlibrarian.net/221945609/fix-llvm-3.5-dev-debian.bash | bash
# Create build directory
mkdir GNUstep-build
cd GNUstep-build
# Set clang as compiler
export CC=clang
export CXX=clang++
# Checkout sources
echo -e "\n\n${GREEN}Downloading sources...${NC}"
mkdir -p libobjc2 && wget -qO- https://github.com/gnustep/libobjc2/archive/v1.8.1.tar.gz | tar xz -C libobjc2 --strip-components=1
mkdir -p make && wget -qO- ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-make-2.6.8.tar.gz | tar xz -C make --strip-components=1
mkdir -p base && wget -qO- ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-base-1.24.9.tar.gz | tar xz -C base --strip-components=1
mkdir -p gui && wget -qO- ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-gui-0.25.0.tar.gz | tar xz -C gui --strip-components=1
mkdir -p back && wget -qO- ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-back-0.25.0.tar.gz | tar xz -C back --strip-components=1
showPrompt
# Build GNUstep make first time
echo -e "\n\n"
echo -e "${GREEN}Building GNUstep-make for the first time...${NC}"
cd make
./configure --enable-debug-by-default --with-layout=gnustep --enable-objc-nonfragile-abi --enable-objc-arc
make -j8
sudo -E make install
. /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
echo ". /usr/GNUstep/System/Library/Makefiles/GNUstep.sh" >> ~/.bashrc
# showPrompt
# Build libobjc2
echo -e "\n\n"
echo -e "${GREEN}Building libobjc2...${NC}"
cd ../libobjc2
rm -Rf build
mkdir build && cd build
cmake ../ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang -DCMAKE_ASM_COMPILER=clang -DTESTS=OFF
cmake --build .
sudo -E make install
sudo ldconfig
export LDFLAGS=-ldispatch
showPrompt
OBJCFLAGS="-fblocks -fobjc-runtime=gnustep-1.8.1"
# Build GNUstep make second time
echo -e "\n\n"
echo -e "${GREEN}Building GNUstep-make for the second time...${NC}"
cd ../../make
./configure --enable-debug-by-default --with-layout=gnustep --enable-objc-nonfragile-abi --enable-objc-arc
make -j8
sudo -E make install
. /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
showPrompt
# Build GNUstep base
echo -e "\n\n"
echo -e "${GREEN}Building GNUstep-base...${NC}"
cd ../base/
./configure
make -j8
sudo -E make install
showPrompt
# Build GNUstep GUI
echo -e "\n\n"
echo -e "${GREEN} Building GNUstep-gui...${NC}"
cd ../gui
./configure
make -j8
sudo -E make install
showPrompt
# Build GNUstep back
echo -e "\n\n"
echo -e "${GREEN}Building GNUstep-back...${NC}"
cd ../back
./configure
make -j8
sudo -E make install
showPrompt
. /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
echo -e "\n\n"
echo -e "${GREEN}Install is done. Open a new terminal to start using.${NC}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment