public
Last active

GNUStep

  • Download Gist
README.md
Markdown

Objective-C on Linux

Just run:

curl -ks https://gist.github.com/nicerobot/5652802/raw/install.sh | bash -
apt.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/bin/bash
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 libpng12-dev
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
gnu_sources.txt
1 2 3 4
ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-make-2.6.2.tar.gz
ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-base-1.24.0.tar.gz
ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-gui-0.22.0.tar.gz
ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-back-0.22.0.tar.gz
install.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
#!/bin/bash
 
# 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:-nicerobot/5652802}
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:-http://download.gna.org/gnustep/libobjc2-1.6.tar.gz}
 
#
 
cd ${INSTALL_DIR} || exit $?
 
 
# apt-get install required packages
 
date >> $(basename ${PWD}).log
echo 'Asking for sudo to run apt-get:'
{
curl -ks ${APT} | sudo bash -
} 2>&1 | tee -a $(basename ${PWD}).log
 
 
# Use clang
 
export CC=clang
 
 
# Install libobjc2
 
LIBOBJC2_DIR=$(basename ${LIBOBJC2##*/} .tar.gz)
[ -d ${LIBOBJC2_DIR} ] || curl -ks ${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 'Asking for sudo to install '$(basename ${PWD})
sudo make install 2>&1 | tee -a ../$(basename ${PWD}).log
) || exit $?
 
 
# Install GNUStep from source
 
curl -ks ${GNUSTEP_SOURCES} | while read dl; do
pkg=$(basename ${dl##*/} .tar.gz)
echo 'Downloading '${pkg}
(
curl -ks ${dl} | tar vzx && cd ${pkg} || exit $?
{
./configure
make
sudo make install
} 2>&1 | tee ../$(basename ${PWD}).log
) 2>&1 | tee -a $(basename ${PWD}).log || exit $?
done
 
 
# Reinstall libdispatch-dev
 
sudo apt-get install -y libdispatch-dev
 
 
# Test it!
 
curl -ksO 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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.