PS118 has published a detailed tutorial on the design and 3D printing of a bookend.
For our library I chose to use wire bakers' racks for the shelves because they were a lot more durable than the cheap pressed-wood shelves for not much more money. Also, I liked the idea that they would not gather dust. One problem with that plan is the difficulty in keeping books from falling over. I decided to design and print some bookends to help out with that.
If all you want is those bookends, just download the finished product from thingiverse and print what you like. If instead you want to learn how to use the free Blender 3d modelling program to engineer your own 3d printable things, then keep reading onward here. I'll walk you through from concept all the way to finished product.