Macports is a tool for installing applications and command line tools on your Mac, with a huge library of “ports” (the Macports term for something that can be installed). You use it in Terminal.app like this:
$ sudo port install nmap
To break this command down:
$ at the beginning generally means that you have to enter the rest of the line into Terminal. In the official documentation, it's a
%%, but they both mean the same thing; don't paste or type that part, only the command after it. You will see the
$ right before your cursor in Terminal.
sudo means that you'll be doing this as the “root user”, which can do (almost) anything with your system. Be very careful when you use it. It only works if you're an admin, and you have to enter your password.
port is the name of the Macports command itself.
install is an argument (also known as a command-line option) to the
port command. You might see this referred to as a “subcommand”, which is because you're telling
port what to do in general, rather than giving a specific thing like the name of what you want to install. Arguments are separated by spaces.
nmap is the name of the program to install. It's another command-line tool, and you use it for things like port scanning.
So, that command uses
nmap tool. You might be installing things that have actual windows and a GUI more often, and that's where X11 comes in.
The X Window System is a system used to show windows, controls, and UI elements in general. The XQuartz project is an implementation of the X Window System on Mac OS X. It is one application that shows all the windows of apps that use X11. Usually, X11 is the easiest way to make something that can be used on both OS X and Linux without extra code, which is why you'll see a lot of Macports “ports” using it.
It's hard to keep the final “binaries” in sync with the source sometimes, which is why some things have to be compiled (turned from source to runnable file/app) on your computer.
It's really complicated under the hood, but the point of it is so people can do all this stuff automagically (with a little knowledge of Terminal and Unix) without having to worry about that. The “portfile” part of what you quoted is just the entry in the Macports database that explains everything that Macports needs to do in order to install something. Meaning it might be a script that you could run in Terminal, or some other program, but the point is to make it so you don't have to do any of the hard work.
Currently, Homebrew is a more popular alternative to Macports, but it doesn't have as many windowed (X11) applications. These types of things are usually called package managers.