In 3.5, the base damage for a medium creature's greatsword is 2d6, not 1d12. You may be thinking of the greataxe, which does deal 1d12 damage.
Your damage on an ordinary attack is
2d6 + 3 (1.5× str) + 2 (spec). In a rage, your strength modifier is +4 (unless you are high-enough level to have an improved rage), so this rises to
2d6 + 6 (1.5× str) + 2 (spec).
Power Attack gives you the option of voluntarily taking a penalty (up to your base attack bonus) on the attack roll in order to gain a bonus on your damage roll. For a two-handed weapon, the bonus is twice the penalty. So you could take a −1 penalty to attack to gain an extra +2 damage, or (provided your BAB is high enough) a −5 penalty to attack for a +10 bonus to damage, and so on. If you use Power Attack, then you must declare the penalty you are taking before you roll to attack, and the penalty and bonus apply to all attack rolls you make this turn.
All of these sources of damage are doubled on a critical hit, including the base damage and all of these bonuses. Usually, the only sort of damage that is not increased on a critical hit is bonus damage dice, such as from sneak attack or a flaming weapon. When dice are increased on a critical hit, such as weapon base damage dice, you generally roll them again rather than multiplying the original result, although I often have seen individual games vary from this.
If you are enraged, take a -4 penalty for Power Attack, and score a critical hit, then your total damage would be
4d6 + 12 (2× 1.5× str) + 4 (2× spec) + 16 (2× power attack), which comes out to 4d6 + 32.
When I play a barbarian, I often write out two different weapon entries on my character sheet, one with rage bonuses and the other without. Then, the only math I have to do on the fly is for Power Attack.