Building a Pipe Gate
Measure the width and height of your gate opening and check that the gate posts are solid. Pipe gates may be mounted on either metal or wood posts, but they must be sturdy. Cut pipe for your frame with a metal saw, and deduct space for the hinges and the latch from your opening measurements. Then weld the four pieces into a rectangle. You can miter the corners or weld them straight; some builders "cope" corners, rounding the ends of the vertical pipes so the top and bottom rails fit in neatly. You can also make rounded corners, but these require pipe-bending tools and experience.
Cut interior posts and rails. Most pipe gates have two or three horizontal rails inside the frame; longer gates also need one or two internal vertical posts for support. These can be the same dimension as the pipe frame or smaller pipe. Experienced builders drill holes in vertical supports for horizontal rails to run through; this works especially well when vertical supports are the same dimension as the frame and the rails are smaller. Weld these in place, making sure all posts and rails are plumb and square.
Attach the hinges and a latch. A variety of hinge styles are available at farm and ranch and building supply stores. The sturdiest is a post and hole type -- a hinge half with a vertical rod is welded to the gate and a retainer with a hole for the rod to slide into is attached to the gate post. Put the rod facing up on the bottom hinge, down on the top hinge. Latches may be simple rods that slide into an opening in the gate post or a receptacle fastened to the post. More elaborate styles have catches that fit over pins on the gate.