Skip to content

Commit cb55248

Browse files
committed
Re-file apparent archival material from releases.md
1 parent 7dd9a41 commit cb55248

File tree

3 files changed

+301
-296
lines changed

3 files changed

+301
-296
lines changed

doc/maintainers/archive/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# README
2+
3+
The `doc/maintainers/archive` directory contains documentation that appears to
4+
have been superceded but is preserved in case it is, in fact, useful.

doc/maintainers/archive/releases.md

Lines changed: 297 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,297 @@
1+
# Archive - from releases.md
2+
3+
## Build Linux static binary distribution with Nix
4+
5+
**NOTE: We have switched back to Alpine Linux for building static binaries, done by CI. Leaving this section for future reference.**
6+
7+
These instructions are tested on Ubuntu 16.04, but theoretically should work on
8+
any Linux distribution.
9+
10+
- Install nix (tested with v2.0.4 and v2.1.2, but should work with any)
11+
12+
```
13+
curl https://nixos.org/nix/install | sh
14+
```
15+
16+
- Install and authenticate cachix (first two steps at https://cachix.org/ after
17+
signing up)
18+
19+
20+
- Add nh2's cache:
21+
22+
```
23+
cachix use static-haskell-nix
24+
```
25+
26+
NOTE: to clear cache index, use `rm $HOME/.cache/nix/binary-cache-v5.sqlite*`
27+
(useful if someone else uploads new stuff to the cache and you want to use it
28+
right away). The recent `narinfo-cache-positive`/`negative-ttl` options might
29+
also help.
30+
31+
- Check out Stack commit to be released to `~/stack-release` (or elsewhere, in
32+
which case adjust following instructions)
33+
34+
- `rm -f ~/stack-release/*.cabal`, to ensure it's regenerated
35+
36+
- clone https://github.com/nh2/static-haskell-nix recursively (last known to
37+
work with commit 725ceb2479637b3b3ab29298a1bc0e48c54984c9)
38+
39+
- in `static-stack` directory, run (from `static-stack/README.md`):
40+
41+
```
42+
$(nix-build --no-link -A run-stack2nix-and-static-build-script --argstr stackDir ~/stack-release)
43+
```
44+
45+
- Run integration tests against the static binary [TODO: improve this process by
46+
adding full support in `release.hs` or the integration tests for testing a
47+
binary built elsewhere]
48+
49+
- In `~/stack-release`, run
50+
`stack build --flag stack:integration-tests stack:stack-integration-test`
51+
- Copy binary built above to place where `stack build` normally puts the
52+
`stack binary` (e.g.
53+
`cp /nix/store/7vl1xvlbbqjvf864inz5vw7z2z1k4nmw-stack-2.1.0.1/bin/stack /home/vagrant/stack-release/.stack-work/install/x86_64-linux/custom-snapshot-for-building-stack-with-ghc-8.2.2-PyNP5UoO8Ott/8.2.2/bin/stack`;
54+
figure it out using `stack exec which stack`)
55+
- Run `stack exec stack-integration-test`
56+
57+
- Copy the binary built above (in `/nix/store/XXX-stack-X.Y.Z/bin/stack`) to
58+
`~/stack-release/_release/bin/stack-X.Y.Z-linux-x86_64/stack` (replace `X.Y.Z`
59+
with the version, and the `/nix/store/*` path with that output at the end of
60+
the previous command)
61+
62+
- Package, sign, and upload to GitHub using Stack's release script in the stack
63+
directory:
64+
65+
```
66+
cd ~/stack-release
67+
stack etc/scripts/release.hs --no-test-haddocks --binary-variant=static --build-args=--dry-run upload
68+
```
69+
70+
(adding `--build-args=--dry-run` ensures the binary you copied will be used rather than building a new one)
71+
72+
- Download the bindist from GitHub and double check that the `stack` in it is
73+
actually static (use `ldd /path/to/stack`) and that `--version` reports
74+
correctly (and not dirty).
75+
76+
## Setting up a Windows VM for releases
77+
78+
These instructions are a bit rough, but has the steps to get the Windows machine
79+
set up.
80+
81+
## Using Virtualbox
82+
83+
1. Download Virtualbox VM image:
84+
https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/mac/
85+
86+
2. Launch the VM using Virtualbox and the image downloaded
87+
88+
3. Adjust settings:
89+
* Number of CPUs: at least half the host's
90+
* Memory: at least 3 GB
91+
* Video RAM: the minimum recommended by Virtualbox
92+
* Enable 3D and 2D accelerated mode (this makes programs with lots of
93+
console output much faster)
94+
* Enabled shared clipboard (in VM window, Devices->Shared
95+
Clipboard->Both Directions)
96+
97+
Now continue to the **General Windows setup** subsection below.
98+
99+
## Using ESXi
100+
101+
1. Download the **MSEdge on Win10** VM for **VMWare (Windows, Mac)**.
102+
2. Unzip the file downloaded file
103+
3. Upload the VMDK file to the ESXi datastore
104+
4. SSH into ESXi CLI and run:
105+
- `vmkfstools -i /vmfs/volumes/datastore1/win10-msedge/MSEdge-Win10-VMWare-disk1-ORIG.vmdk /vmfs/volumes/datastore1/win10-msedge/MSEdge-Win10-VMWare-disk1.vmdk -d thin`.
106+
This converts the disk to a format that is compatible with ESXi. You may
107+
have to run `esxcli system module load -m multiextent` first (see
108+
https://www.virtuallyghetto.com/2012/09/2gbsparse-disk-format-no-longer-working.html).
109+
- `vmkfstools -X 80G /vmfs/volumes/datastore1/win10-msedge/MSEdge-Win10-VMWare-disk1.vmdk`.
110+
This makes the disk twice as large, which helps avoid running out of disk
111+
space.
112+
5. In the ESXi web UI:
113+
- Create a new VM
114+
- Give is 8192 MB of memory
115+
- Give it 4 virtual CPUs
116+
- Remove the default hard disk
117+
- Add an **Existing hard disk**
118+
- Select `/datastore1/win10-msedge/MSEdge-Win10-VMWare-disk1.vmdk`
119+
- Power on the VM
120+
- In Windows settings:
121+
- Search for "disk management"
122+
- Extend the partition to take the whole disk.
123+
- In all likelihood, you will want to search for "remote desktop" and enable
124+
remote desktop. Then you can connect to the VM using Microsoft Remote
125+
Desktop instead of using it from within the ESXi web UI.
126+
127+
Now continue to the **General Windows setup** subsection below.
128+
129+
## General Windows setup
130+
131+
5. In **Settings**->**Update & Security**->**Windows Update**->**Advanced options**:
132+
* Change **Choose how updates are installed** to **Notify to schedule restart**
133+
* Check **Defer upgrades** (this avoids rebooting in the middle of the stack
134+
build)
135+
136+
6. In **Settings**->**System**->**Power & sleep**
137+
138+
* Disable turning off the screen or going to sleep when plugged in
139+
140+
7. Install msysgit: https://msysgit.github.io/
141+
142+
8. Install TortoiseHG: https://tortoisehg.bitbucket.io/download/index.html
143+
144+
9. Install nsis-2.46.5-Unicode-setup.exe from http://www.scratchpaper.com/
145+
146+
10. Install Stack using the Windows 64-bit installer
147+
148+
a. Restart any command prompts to ensure they get new `%STACK_ROOT%` value.
149+
150+
11. Visit https://hackage.haskell.org/ in Edge to ensure system has correct CA
151+
certificates
152+
153+
13. Run in command prompt:
154+
155+
md C:\p
156+
md C:\tmp
157+
cd /d C:\p
158+
159+
14. Create `C:\p\env.bat`:
160+
161+
SET TEMP=C:\tmp
162+
SET TMP=C:\tmp
163+
SET PATH=C:\Users\IEUser\AppData\Roaming\local\bin;"c:\Program Files\Git\usr\bin";"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin";%PATH%
164+
165+
15. Run `C:\p\env.bat` (do this every time you open a new command prompt)
166+
167+
16. `stack exec -- gpg --import`, and paste in the your GPG secret key (must be
168+
done using `stack exec` because that uses the right keyring for the embedded
169+
MSYS2 GPG; you can get the key from another machine with
170+
`gpg --export-secret-keys --armor <KEY ID>`)
171+
172+
17. Run in command prompt (adjust the `user.email` and `user.name` settings):
173+
174+
git config --global user.email [email protected]
175+
git config --global user.name "Emanuel Borsboom"
176+
git config --global push.default simple
177+
git config --global core.autocrlf true
178+
git clone https://github.com/borsboom/stack-installer.git
179+
git clone -b stable --reference C:\p\stack-release https://github.com/commercialhaskell/stack.git stack-release
180+
cd stack-release
181+
stack install cabal-install
182+
183+
184+
## Setting up an ARM VM for releases
185+
186+
1. Use Scaleway to start ARMv7 and ARM64 VMs.
187+
188+
2. Select Ubuntu Xenial as the operating system
189+
190+
3. Install the correct version of LLVM: `sudo apt-get install -y llvm-3.9`
191+
(appropriate for GHC 8.2, might need different version for other GHCs)
192+
193+
4. Symlink opt-3.X to `opt`: `sudo ln -s opt-3.9 /usr/bin/opt` (adjust the
194+
version if you installed a different one above)
195+
196+
5. Switch to gold linker:
197+
198+
```
199+
update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20
200+
update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10
201+
update-alternatives --config ld
202+
```
203+
204+
6. Add swap space:
205+
206+
```
207+
dd if=/dev/zero of=/swapfile1 bs=1024 count=4194304
208+
mkswap /swapfile1
209+
swapon /swapfile1
210+
echo '/swapfile1 none swap sw 0 0' >>/etc/fstab
211+
```
212+
213+
7. Install additional tools:
214+
215+
```
216+
apt-get update && apt-get install -y unzip gpg
217+
```
218+
219+
8. Import your GPG key (`gpg --import` and paste the private key)
220+
221+
9. Git settings (adjust for your preferences/email/name)
222+
223+
git config --global push.default simple
224+
git config --global user.email "[email protected]"
225+
git config --global user.name "Emanuel Borsboom"
226+
227+
10. Install build tools and dependencies packages
228+
229+
sudo apt-get install -y g++ gcc libc6-dev libffi-dev libgmp-dev make xz-utils zlib1g-dev git gnupg
230+
231+
11. Install clang+llvm
232+
233+
NOTE: the Debian jessie `llvm` package does not work (executables built with
234+
it just exit with "schedule: re-entered unsafely.").
235+
236+
The version of LLVM needed depends on the version of GHC you need.
237+
238+
* GHC 8.2.2 (the standard for building Stack)
239+
240+
```
241+
wget http://llvm.org/releases/3.9.1/clang+llvm-3.9.1-armv7a-linux-gnueabihf.tar.xz && \
242+
sudo tar xvf clang+llvm-3.9.1-armv7a-linux-gnueabihf.tar.xz -C /opt
243+
```
244+
245+
Run this now and add it to the `.profile`:
246+
247+
```
248+
export PATH="$HOME/.local/bin:/opt/clang+llvm-3.9.1-armv7a-linux-gnueabihf/bin:$PATH"
249+
```
250+
251+
* GHC 7.10.3
252+
253+
```
254+
wget http://llvm.org/releases/3.5.2/clang+llvm-3.5.2-armv7a-linux-gnueabihf.tar.xz && \
255+
sudo tar xvf clang+llvm-3.5.2-armv7a-linux-gnueabihf.tar.xz -C /opt
256+
```
257+
258+
Run this now and add it to the `.profile`:
259+
260+
```
261+
export PATH="$HOME/.local/bin:/opt/clang+llvm-3.5.2-armv7a-linux-gnueabihf/bin:$PATH"
262+
```
263+
264+
12. Install Stack
265+
266+
Binary: get an
267+
[existing `stack` binary](https://github.com/commercialhaskell/stack/releases)
268+
and put it in `~/.local/bin`.
269+
270+
From source, using Cabal (the tool):
271+
272+
```
273+
wget http://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3-armv7-deb8-linux.tar.xz && \
274+
tar xvf ghc-7.10.3-armv7-deb8-linux.tar.xz && \
275+
cd ghc-7.10.3 && \
276+
./configure --prefix=/opt/ghc-7.10.3 && \
277+
sudo make install && \
278+
cd ..
279+
export PATH="/opt/ghc-7.10.3/bin:$PATH"
280+
wget https://www.haskell.org/cabal/release/cabal-install-1.24.0.0/cabal-install-1.24.0.0.tar.gz &&&&& \
281+
tar xvf cabal-install-1.24.0.0.tar.gz && \
282+
cd cabal-install-1.24.0.0 && \
283+
EXTRA_CONFIGURE_OPTS="" ./bootstrap.sh && \
284+
cd .. && \
285+
export PATH="$HOME/.cabal/bin:$PATH" && \
286+
cabal update
287+
```
288+
289+
Edit `~/.cabal/config`, and set `executable-stripping: False` and
290+
`library-stripping: False`.
291+
292+
```
293+
cabal unpack stack && \
294+
cd stack-* && \
295+
cabal install && \
296+
mv ~/.cabal/bin/stack ~/.local/bin
297+
```

0 commit comments

Comments
 (0)