Remove shared libraries before copying them into place

Fixes issue #1037

When building an extension that's still loaded into memory, cp_r replaces the
file contents of the same inode. Since Linux mmaps shared libs, they will get
reloaded but not relocated, leading to corruption of the GOT/PLT.

The fix is to unlink the destination before copying, which creates a new inode
and prevents the file from being reloaded.
Merge pull request #1038 from pushrax/fix-ext-reloading-segfault

Remove shared libraries before copying them into place