Reworked library building & linking.