#!/bin/sh # Slackware build script for Free Pascal # Written by Michiel Broek # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # Modified by the SlackBuilds.org project. PACKAGE="fpc" PACKAGE_EXT="gz" VERSION=${VERSION:-3.2.2} BUILD=${BUILD:-1} if [ -f ~/.slackbuildrc ]; then . ~/.slackbuildrc elif [ -f ../../runtime/slackbuildrc ]; then . ../../runtime/slackbuildrc fi check_required BSRC="${PACKAGE}build-$VERSION.tar.$PACKAGE_EXT" BURL="https://downloads.sourceforge.net/freepascal/$BSRC" get_source $BSRC $BURL unpack_source $BSRC ${PACKAGE}build-${VERSION} pushd fpcsrc/compiler fpcmake -Tall popd make build NOGDB=1 export HOME="$TMP" make -j1 PREFIX=$PKG/usr install NOGDB=1 export PATH=$PKG/usr/bin:$PATH [ "$LIBDIRSUFFIX" = "64" ] && mv $PKG/usr/lib $PKG/usr/lib${LIBDIRSUFFIX} [ "$ARCH" = "x86_64" ] && ln -s /usr/lib$LIBDIRSUFFIX/fpc/${VERSION}/ppcx64 $PKG/usr/bin/ # create and fix configuration files. mkdir -p $PKG/etc $PKG/usr/lib$LIBDIRSUFFIX/fpc/${VERSION}/samplecfg $PKG/usr/lib$LIBDIRSUFFIX/fpc/${VERSION} $PKG/etc # use -fPIC by default echo -e "#ifdef cpux86_64\n# for x86_64 use -fPIC by default\n-Cg\n#endif" >> "$PKG/etc/fpc.cfg" mv $PKG/etc/fpc.cfg $PKG/etc/fpc.cfg.new mv $PKG/usr/share/doc $PKG/usr install -Dm0644 fpcsrc/rtl/COPYING.FPC $DOCS rm -rf $PKG/usr/share find $PKG/etc/ -type f -exec sed -i "s|"$PKG"||g" {} \; # Install sourcecode for lazarus SSRC="fpc-$VERSION.source.tar.$PACKAGE_EXT" SURL="https://downloads.sourceforge.net/freepascal/$SSRC" get_source $SSRC $SURL mkdir -p $PKG/usr/src cd $PKG/usr/src tar xvfz $CWD/$SSRC ln -s $PACKAGE-$VERSION $PACKAGE pushd $PKG/usr/src # fix permissions chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) -exec chmod 755 {} \; -o \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; popd echo "** Fixup and build package" fixup_package $PKG # Clean up the extra stuff: set +u if [ "$1" = "--cleanup" ]; then rm -rf $TMP/$PACKAGE-$VERSION rm -rf $PKG fi