Building druntime on MAC OS X

Andrew Edwards ridimz at yahoo.com
Thu Nov 21 03:17:56 PST 2013


On 11/18/13, 3:13 AM, Jacob Carlborg wrote:
> On 2013-11-17 17:32, Andrew Edwards wrote:
>
>> I have couple issues remaining for Mac OS X that I'm hoping you can
>> provide some clarification on:
>>
>> 1) The install option for TOOLS, unlike DMD, DRUNTIME or PHOBOS attempts
>> to install the generated binaries directly to /usr/local/bin/. Better to
>> insert them in ../install/bin/ like the other three allowing for
>> automatic inclusion in the release zip and installer.
>
> I don't know. This doesn't seem specific to Mac OS X. I guess what's
> ever making it easier to automate releases.
>
>> 2) Executing DMD with no arguments displays the version number,
>> copyright, and usage info of course. Whether building from the v2.064 or
>> v2.064.2 tag on github, the resulting binary always displays "DMD64 D
>> Compiler v2.064-devel-a9eedd1". How do I get it to build in the correct
>> version? The VERSION file is present in the git clone but for some
>> reason it is ignored?
>
> Try the latest HEAD. For me that correctly updates the version number
> and the git hash.
>

That is good but we will be building from a branch when it's time to 
prepare the binaries. Or do we first prepare the binaries then branch?

Any idea how I access and run the auto tester from my machine? I've 
tried contacting Brad Anderson but no response. Maybe I had the wrong 
email address.

This is the script I use to build DMD. It currently assumes there is a 
file (VERSION) in the current folder containing an existing branch tag 
(2.064, 2.064.2, etc...), retrieves the relevant repositories (DMD, 
PHOBOS, DRUNTIME and TOOLS), builds them, and produces a gz2 and dmg 
file in the $HOME directory. It is very brittle so any suggestions to 
make it more usable would be appreciated. The end goal is to run it as 
the last step in the auto tester which will eliminate more than half of 
the commands it currently contains.

<begin file>
#!/usr/bin/env /bin/bash

##
# Author:: Andrew Edwards
# Version:: Initial created: 2013
# License:: Public Domain

# Create directories to house generated ouput
mkdir -p .work  && cd .work

# Fetch source from github
getdmd="git clone -q --progress -bv$(<~/VERSION) 
https://github.com/D-Programming-Language";
$getdmd"/dmd.git";
$getdmd"/druntime.git";
$getdmd"/phobos.git";
$getdmd"/tools.git";

# Build DMD, making changes to dmd.conf as necessary
cd dmd;
make -f posix.mak install;
cat ../install/bin/dmd.conf | sed "s/-L--export-dynamic //g" > 
../install/bin/dmd.conf2
cat ../install/bin/dmd.conf2 | sed "s/-L-lrt//g" > ../install/bin/dmd.conf
rm  ../install/bin/dmd.conf2

# Build DRUNTIME
make -C ../druntime -f posix.mak install DMD=../install/bin/dmd

# Build PHOBOS
make -C ../phobos -f posix.mak install DMD=../install/bin/dmd

# Build TOOLS
make -C ../tools -f posix.mak install DMD=../install/bin/dmd

# Move tools to correct location
mv ../tools/generated/osx/default/catdoc ../install/bin
mv ../tools/generated/osx/default/changed ../install/bin
mv ../tools/generated/osx/default/ddemangle ../install/bin
mv ../tools/generated/osx/default/detab ../install/bin
mv ../tools/generated/osx/default/dget ../install/bin
mv ../tools/generated/osx/default/rdmd ../install/bin
mv ../tools/generated/osx/default/tolf ../install/bin

# Generate zip file
ditto ../install ~/.dmg/usr/share/dmd
ditto -jc --keepParent ~/.dmg/usr/share/dmd ~/dmd.$(<~/VERSION).bz2

# Place DMD in path
mkdir -p ~/.dmg/etc/paths.d
cat >~/.dmg/etc/paths.d/dmd <<'EOT'
/usr/share/dmd/bin
/usr/share/dmd/man/man1
EOT

# Generate installer
mkdir -p dmd.$(<~/VERSION)

cat >dmd.$(<~/VERSION)/uninstall.command <<'EOT'
#!/usr/bin/env bash

sudo -p "Please provide your password to uninstall DMD: " rm -rf 
/usr/share/dmd
sudo -p "Please provide your password to uninstall DMD: " rm -f 
/etc/paths.d/dmd

echo "Uninstallation complete!\n"
EOT

chmod +x dmd.$(<~/VERSION)/uninstall.command

pkgbuild --identifier org.dlang.pkg.app --root ~/.dmg 
dmd.$(<~/VERSION)/dmd.$(<~/VERSION).pkg
hdiutil create -ov -srcfolder dmd.$(<~/VERSION) ~/dmd.$(<~/VERSION).dmg

cd ~ && rm -rf .dmg .work
</end file>


More information about the Digitalmars-d mailing list