Skip to content

Instantly share code, notes, and snippets.

@shoeper
Forked from felipemeamaral/README.md
Last active March 21, 2022 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shoeper/8be35cf2b7c4bdf9ae423b260f43ab3d to your computer and use it in GitHub Desktop.
Save shoeper/8be35cf2b7c4bdf9ae423b260f43ab3d to your computer and use it in GitHub Desktop.
GNUStep

Objective-C on Linux

Just run: -> doesn't work (anymore)

apt-get update && apt-get install wget vim -y && wget -O - https://gist.github.com/shoeper/8be35cf2b7c4bdf9ae423b260f43ab3d/raw/install.sh | bash -
#!/bin/bash
ln -fs /usr/share/zoneinfo/Europe/Berlin /etc/localtime
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
apt-get install -y build-essential
apt-get install -y clang
apt-get install -y libblocksruntime-dev
apt-get install -y libkqueue-dev
apt-get install -y libpthread-workqueue-dev
apt-get install -y gobjc
apt-get install -y libxml2-dev
apt-get install -y libjpeg-dev
apt-get install -y libtiff-dev
apt-get install -y libpng-dev # libpng12-dev is not available, anymore
apt-get install -y libcups2-dev
apt-get install -y libfreetype6-dev
apt-get install -y libcairo2-dev
apt-get install -y libxt-dev
apt-get install -y libgl1-mesa-dev
apt-get remove -y libdispatch-dev
apt-get install -y cmake
apt-get install -y libxslt1-dev
apt-get install -y libgnutls-dev
ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-make-2.7.0.tar.gz
ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-base-1.25.1.tar.gz
ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-gui-0.26.2.tar.gz
ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-back-0.26.2.tar.gz
#!/bin/bash
set -x
# The following variables can be overridden from the command-line.
# e.g. curl...install.sh | INSTALL_DIR=objc_test GNUSTEP_SOURCES=https://...mygnu bash -
mkdir ${INSTALL_DIR:=gnustep-dev}
GIST=${GIST:-shoeper/8be35cf2b7c4bdf9ae423b260f43ab3d}
GIST_ROOT=${GIST_ROOT:-https://gist.github.com/${GIST}}
APT=${APT:-${GIST_ROOT}/raw/apt.sh}
GNUSTEP_SOURCES=${GNUSTEP_SOURCES:-${GIST_ROOT}/raw/gnu_sources.txt}
LIBOBJC2=${LIBOBJC2:-https://github.com/gnustep/libobjc2/archive/v1.8.1.tar.gz}
#
cd ${INSTALL_DIR} || exit $?
# apt-get install required packages
date >> $(basename ${PWD}).log
echo 'Run apt-get:'
{
wget -O- -q ${APT} | bash -
} 2>&1 | tee -a $(basename ${PWD}).log
# Use clang
export CC=clang
# Install libobjc2
LIBOBJC2_DIR="libobjc2-1.8.1" #$(basename ${LIBOBJC2##*/} .tar.gz)
[ -d ${LIBOBJC2_DIR} ] || wget -O - ${LIBOBJC2} | tar zx || exit $?
(
cd ${LIBOBJC2_DIR} || exit $?
date >../$(basename ${PWD}).log
echo 'Building '$(basename ${PWD})
make 2>&1 | tee -a ../$(basename ${PWD}).log
echo 'Install '$(basename ${PWD})
make install 2>&1 | tee -a ../$(basename ${PWD}).log
) || exit $?
# Install GNUStep from source
wget -O - -q ${GNUSTEP_SOURCES} | while read dl; do
pkg=$(basename ${dl##*/} .tar.gz)
echo 'Downloading '${pkg}
(
wget -O - ${dl} | tar vzx && cd ${pkg} || exit $?
{
./configure
make
make install
} 2>&1 | tee ../$(basename ${PWD}).log
) 2>&1 | tee -a $(basename ${PWD}).log || exit $?
ln -s /usr/local/lib/libgnustep-base.so.1.25.1 /usr/lib/libgnustep-base.so.1.25
ln -s /usr/local/lib/libobjc.so.4.6 /usr/lib/libobjc.so.4.6
done
# Reinstall libdispatch-dev
apt-get install -y libdispatch-dev
# Test it!
wget https://gist.github.com/starbugs/5021960/raw/cf6982b93cbce7ccaccc1e3c9c57309db51ae831/main.m && {
clang `gnustep-config --objc-flags` \
-o main \
-x objective-c main.m \
-fconstant-string-class=NSConstantString \
-fobjc-nonfragile-abi \
-fblocks \
-lgnustep-base \
-lgnustep-gui \
-ldispatch \
-I/usr/include/GNUstep \
-L/usr/lib/GNUstep | tee -a $(basename ${PWD}).log
} && LD_LIBRARY_PATH=/usr/local/lib ./main
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment