Hi, for a 40 inch opening you will need 40 inches on at least one side of the door to open and 80 inches of barn door rolling hardware. When open the door, by most codes, should not block a fire or disaster escape. You may consider using two 20 inch doors and sliding open in the middle. Any type of material can be used to create the doors, but ready made barn hardware has gotten pricey. Consider alternatives such as play equipment wheels and buying separate pieces of iron to build the hardware yourself. Good luck!
I have reclaimed barn wood for sale at good price. I am in SC. Contact if interested