Properly static lib packaging

Fixes #18574
auto merge of #18739 : vhbit/rust/issue-18574, r=alexcrichton

Fixes #18574